Run shell command in VBA

Posted on 2008-11-19
Last Modified: 2012-05-05
I have tested the below code running from a macro in excel and it works fine
Shell "rundll32.exe C:\WINDOWS\System32\shimgvw.dll,ImageView_Fullscreen \\path"

But instead of opening fax viewer i want to open document imaging. I tried this but it doesn't work. I know document imaging is mspview.exe but don't know if thats what i need.
Shell "rundll32.exe C:\Program Files\Common Files\Microsoft Shared\MSPaper\MSPVIEW.EXE, \\path"

Also instead of path I want the value of the active cell in excel, which is the path.

Any help would be appreciated as I have tried loads of variations
Question by:j8547
    LVL 21

    Accepted Solution

    Try this.

    Shell "C:\Program Files\Common Files\Microsoft Shared\MSPaper\MSPVIEW.EXE"

    Author Comment

    Yes that works. I have tried that path before but I was putting the run infront of it and then nothing was happening. It opens up document imaging. How do I pass the value of the active cell. it is a path to a file

    Author Comment

    Got all working. Thanks for your help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

    779 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

    21 Experts available now in Live!

    Get 1:1 Help Now