Timothy has attended:
Access Advanced course
Opening files and programs
So,
Opening a program is easy using the shell function. Howeve I am scratching my head around how to tie this into opening a file using ShellExecute.
As I understand it, ShellExecute opens some files depending on type. I'm want to open a PDF which is not one of those types.
Can I get away with having both these functions in the same procedure or do I need to create a value in ShellExecute and send it to the Shell function when I call that?
Cheers
Tim
RE: Opening files and programs
Timothy, try the RunApp command instead. Create a macro with the Action RunApp. Then in the command line field in Action Arguments type the path to the application followed by the path to the file. E.g.
C:\Program Files\Microsoft Office\Office14\excel.exe c:\myspreadsheet.xls
Anthony
RE: Opening files and programs
Hi Anthony,
Unfortunately RunApp is not going to work in this situation. Unless I can substitute the file path with a field that contains a file path written out.
That's why I moved down the VBA route instead of trying to resolve with a macro.
Cheers
Tim
RE: Opening files and programs
Shell is a VBA keyword, ShellExecute is a Windows API function, so you don't use one to enable the other. Most people favour ShellExecute. There's a download here with a worked example which is rather good:
http://www.access-programmers.co.uk/forums/showthread.php?t=97787
Anthony