Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Shell non Executables

Status
Not open for further replies.

rogerl101

IS-IT--Management
Jan 24, 2003
25
US
I am trying to duplicate the process of double-clicking on a file in the Explorer window from within Access. For example, double-clicking a file called document.pdf will automatically open the Adobe reader and load the document.

I have tried to use the Shell command to accomplish this, but it seems to want to only work with executable files.

Is there a way to do this from within a VBA procedure?

Thanks

 
Hi,

Shell runs an executable, it follows that if you want a .pdf to run - you shell the adobe reader with the selected file as a parameter e.g.:

shell "adobe.exe", "clickedfile.pdf"
(not necessarily syntactically correct).

To enable you to do this, you'd need to check the extension (.pdf) and 'know' what application to run to execute it.
Therefore, you'd need a table of file extensions and their corresponding applications to run them, e.g.

tblExtensions
ext text
exec text

tbleExtensions
ext exec
.pdf c:\program files\adobe.exe
.doc c:\program files\microsoft\msword.exe
.xls c:\program files\microsoft\msexcel.exe

This method will work. If you get any replies about using shell indirectly - I'd be interested to know.

Kind regards,

Darrylle "Never argue with an idiot, he'll bring you down to his level - then beat you with experience." darrylles@totalise.co.uk
 
Thank you Rick39

The sample code you directed me to worked great.

Thanks everybody for your help

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top