opening files and programs

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Access VBA Training and help » Opening files and programs

Opening files and programs

resolvedResolved · High Priority · Version 2007

Edited on Wed 14 Mar 2012, 17:11

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

RE: Opening files and programs

Thanks Anthony,
Got it all working.

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Access tip:

Zoom feature for queries

If youare working on on query design and creating a calculated field, it can be hard to view the whole statement. You can hold the shift key down and press F2, to show the zoomed up version of the query field

View all Access hints and tips


Server loaded in 0.08 secs.