Link to home
Start Free TrialLog in
Avatar of leonvan
leonvan

asked on

excel system call with spaces in program path

Hi,

I want to add a series of buttons to a spreadsheet that will run a program with different values.  The program path has a space in it, so I need to account for that.  The argurments may have spaces, but I am trying to eat the elephant one bite at a time.   I looked at https://www.experts-exchange.com/questions/21731126/Process-Start-EXCEL-EXE-filepath.html, but I get errors in my implementation.  On the DIm p1 statement I get:
   compile error  user defined type not defined
Help is appreciated.
Leon
Public Sub test_sys_call()
  Dim p1 As New Process
  p1.StartInfo.Filename = "C:\Program Files\ultravnc\vncviewer.exe" ' required
  p1.StartInfo.Arguments = "192.168.1.4" ' required
  p1.Start()
End Sub

Open in new window

Avatar of Nate_Oliver
Nate_Oliver
Flag of United States of America image

Hello, I'm not familiar  with that Type, myself. I'd be tempted to try ShellExecute(), an API call, myself. There's a write-up, here:

http://www.suodenjoki.dk/us/productions/articles/vbashellexecute.htm

Ignore the fact that they're using PPT, it works in any VBA environment.
ASKER CERTIFIED SOLUTION
Avatar of Nate_Oliver
Nate_Oliver
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial