Question

I have a C# console application. I currently have a scheduled task setup to run the application and it provides two command line arguments, shown below.

/AUTORUN FALSE /INTRADAY FALSE 

What I would like to know is if it is possible to have an Excel run the C# console application and pass command line arguments? For example an excel spreadsheet contains a button that when clicked will start my C# console application?

Update

I am using the code below. The console application loads but it does appear to read my command line arguements

Sub TestConsole()

Dim id As Integer

id = Shell("""C:\Shared\Blah\Visual  Studio\MyProg\bin\Release\MyProg.exe"" /HOLDING_CHANGES TRUE", vbNormalFocus)


End Sub
Was it helpful?

Solution

You can use the VB Shell function in a macro.

Sample from MSDN:

Dim procID As Integer 
' Run calculator.
procID = Shell("C:\Windows\system32\calc.exe", AppWinStyle.NormalFocus)
' The preceding path is for Windows XP. 
' The Windows 2000 path is C:\WINNT\system32\calc.exe.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top