Im trying to create an excel spreadsheet (2007) where i can create a button an assign a macro to it to open different software.
For example click the button on the spreadsheet and it opens Sim.exe!
Can this be done and if so how?
Cheers not that good with excel
this should be quite simple, just add a button in to the spreadsheet, when it asks you which macro to run, select "New" then add the following code:
additionally, if you type a comma after the path to the exe, you'll get a self explanatory list of window modes to open the program in.Code:Shell "Path to the exe goes here"
Final tip: you can pass any file/folder to the Shell command and it will be opened in it's default viewer
don't forget that Sims is called pulsar.exe, though you might have to run simsload.exe to start it properly
Last edited by LosOjos; 18th March 2010 at 02:23 PM.
Tryed to test this the code below:
Shell "C:\Program Files\Microsoft Virtual PC.exe"
get the error runtime error '53' file not found?
any ideas have googled this but the file location is defo the one above?
if a nut shell im trying to link all my tech tools to a excel spreadsheet to run the and organise them from there....
Should it beShell "C:\Program Files\Microsoft Virtual PC.exe"
I still doubt that is right though there still seems to be something missing.Shell "C:\Program Files\Microsoft\Virtual PC.exe"
If you're certain that's the right path (although I agree with ChrisH, it seems quite unlikely the exe would be in the program files folder) then it might be that there are restrictions in place to stop VBA accessing the file system, try it with another file and see if it works, and also try using it to open a file in your home folder, I have had trouble in the past with VBA writing to the file system but not usually reading from it/calling a file from the shell command.
If all else fails, try calling a file on a memory stick.
Other than that I can't see why it wouldn't work, the code you used is fine
Last edited by LosOjos; 19th March 2010 at 09:18 AM.
Once you know for sure it is the correct directory then you could do the above and use shell or make your own function in vba to launch exe files possibly using API calls in a module to shell execute ( assuming that api still exists ) it used to be shell execute in windows xp but if you are on windows 7 or vista etc you might run into problems with UAC and on windows 7 stricter permissions on the program files directory and other directories.
There are currently 1 users browsing this thread. (0 members and 1 guests)