How do I open an external program from Access

tosspot

New member
Local time
Yesterday, 16:26
Joined
Jul 2, 2007
Messages
5
How can I start up an external program, eg. Pagemaker, and open up a specific file. I know I can use the 'shell' command to start Pagemaker, but I can't see how to make it start up a particular Pagemaker file. I did something similar for a Word file, using 'createobject' but that only seems to work for MS Office applications. Any help would be much appreciated.
 
search access help for SHELL and ShellExecute and all will be revealed
 
Thanks for the reply, but I can't get 'shell' to work. It will open Pagemaker, but comes up with 'f'ile not found' for the file i want to open. The line I tried is:-
shell "C:\program Files\Adobe\Pagemaker\pm70.exe D:\My Documents\Pagemaker\Directory2007.pmd"

Is that the right syntax?
 
I did something similar for a Word file, using 'createobject' but that only seems to work for MS Office applications.

That method works for anything that exposes itself to Component Object Model technology. Obviously, your version of Pagemaker doesn't.

Offhand, that looks like reasonable syntax. Can you create a shortcut to Pagemaker and edit its command-line (visible when you right-click the short-cut icon) to look just like the line you gave to the SHELL routine? If so, edit the icon as suggested and then try to use it to launch Pagemaker on your targeted file. You might see an error in that context that you wouldn't see in Access context because of the shell being in the way. If you can at least see the error message, it would give you some feedback on what is wrong.
 
easier to test using the run command avaiable from the Start Button(menu)
 
Thanks for the reply, but I can't get 'shell' to work. It will open Pagemaker, but comes up with 'f'ile not found' for the file i want to open. The line I tried is:-
shell "C:\program Files\Adobe\Pagemaker\pm70.exe D:\My Documents\Pagemaker\Directory2007.pmd"

Is that the right syntax?

Almost right, because of the spaces in the path names you need to surround the complete path in quotes.

Code:
shell "[SIZE="5"][COLOR="Red"]'[/COLOR][/SIZE]C:\program Files\Adobe\Pagemaker\pm70.exe[SIZE="5"][COLOR="Red"]'[/COLOR][/SIZE] [SIZE="5"][COLOR="Red"]'[/COLOR][/SIZE]D:\My Documents\Pagemaker\Directory2007.pmd[SIZE="5"][COLOR="Red"]'[/COLOR][/SIZE]"
 
Thanks for the response. I tried testing opening the file using a desktop shortcut and the 'Start' menu 'run' command using the line
"c:\program files\adobe\PageMaker 7.0\pm70.exe" "d:\my documents\pagemaker\directory2007.pmd"
Both worked, but that line doesn't work with 'shell' command from Access. Is there a way I can call the shorcut from Access??
 
Good call, PeterF.

I've learned to live with that option, but I don't think I ever forgave Bill Gates for allowing those blanks in a folder name.
 
Thanks for the response. I tried testing opening the file using a desktop shortcut and the 'Start' menu 'run' command using the line
"c:\program files\adobe\PageMaker 7.0\pm70.exe" "d:\my documents\pagemaker\directory2007.pmd"
Both worked, but that line doesn't work with 'shell' command from Access. Is there a way I can call the shorcut from Access??

Just tested it myself and the single quote seems not to work, the following worked.
Code:
Shellstr =  chr(34) & "C:\Program Files\Adobe\Acrobat 7.0\Reader\AcroRd32.exe" & chr(34) &  " " & chr(34) & "C:\Program Files\Adobe\Acrobat 7.0\Resource\ENUtxt.pdf" & chr(34) 
shell shellstr, vbMaximizedFocus

@The_Doc_Man
The fact it is possible to have spaces is a user thing, but that a default M$ install uses spaces is unforgivable.
 
Brilliant!!!!! Using the chr(34) etc works fine. Thanks for your help
 

Users who are viewing this thread

Back
Top Bottom