excel system call with spaces in program path

Posted on 2009-05-02
Last Modified: 2012-05-06

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, but I get errors in my implementation.  On the DIm p1 statement I get:
   compile error  user defined type not defined
Help is appreciated.
Public Sub test_sys_call()

  Dim p1 As New Process

  p1.StartInfo.Filename = "C:\Program Files\ultravnc\vncviewer.exe" ' required

  p1.StartInfo.Arguments = "" ' required


End Sub

Open in new window

Question by:leonvan
    LVL 2

    Expert Comment

    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:

    Ignore the fact that they're using PPT, it works in any VBA environment.
    LVL 2

    Accepted Solution

    This might be a better overview on ShellExecute():

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
    This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
    This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now