Universal VBA code for opening MS (Office ) programs from excel

B

Boris

All,

I would like to develop a VBA code that opens other programs (like
PowerPoint, or Paint). The VBA code should be universal, i.e. should work on
different machines.

Since the applications will be installed on different machines and paths, I
would like to know how I can write a universal code that opens the programs,
no matter where these are installed.

Could someone give some recommendations?

Best,
 
T

The Code Cage Team

You have to use the Shell command, this is directly from the excel
help:
This example uses the Shell function to run an application specified by
the user. On the MacIntosh, the default drive name is "HD" and portions
of the pathname are separated by colons instead of backslashes.
Similarly, you would specify Macintosh folders instead of \Windows.

' Specifying 1 as the second argument opens the application in
' normal size and gives it the focus.
Dim RetVal
RetVal = Shell("C:\WINDOWS\CALC.EXE", 1) ' Run Calculator.


--
The Code Cage Team

Regards,
The Code Cage Team
www.thecodecage.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top