How to run a program from inside VBA in Powerpoint 2003

Posted on 2010-01-12
Medium Priority
Last Modified: 2012-06-27
I'm not able to run an external program from inside a VBA program (in PowerPoint 2003). The command "shell" doesn't work (I used it successfully in Excel 2003!). The error message says that t's an invalid function call. Any suggestion?
Question by:blos
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 26296160
Is the information here helpful? Seems like another command can be used according to this...

LVL 23

Expert Comment

ID: 26300732
Shell DOES work in PowerPoint

What code are you using


Dim RetVall As Double
RetVal = Shell("pathtofile")

Author Comment

ID: 26301057
The not working line is:
    Dim lngHWnd As Double
lngHWnd = Shell("X:\Documenti\My Data\VB\Albero genealogico.exe", vbNormalFocus)
The file "X:\Documenti\My Data\VB\Albero genealogico.exe" exists and can be run without troubles.
In the object visualization I can see: Librery:VBA, Class: Interaction, Member: Shell, but the above line doesn't work
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Accepted Solution

trungk43 earned 600 total points
ID: 26368029
Please try this link. It works fine for PP 2003


Author Comment

ID: 26378276
Thanks trungk43
It works fine, and does exactly what I need!

Author Comment

ID: 26378953
You have to PAY ATTENTION when initializing the cmdline$ string, because blanks are interpreted as command line parameter separators! So if your executable file name has blanks inside it, it must be enclosed between inverted commas; by example, if the name of the program you have to run is MY PROGRAM.EXE,
the following line is right:
cmdline$="""MY PROGRAM.EXE"""
because the resulting string is delimited by inverted commas, while the following line is wrong:
cmdline$="MY PROGRAM.EXE"
because it's interpreted as "run the program MY with the parameter PROGRAM.EXE"

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
PowerPoint is the go-to presentation software for millions of users around the world. Many presentations use basic text features but you can really make special text jump out of your slide by applying this bubble text design process. This article ha…
This video teaches viewers how to add transitions to their Slideshows and how to set up timing for the transitions.
The viewer will learn how to edit the master slide. They will also learn how to combine multiple themes into one master slide to use them in their presentation.
Suggested Courses

777 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