opening files from Access form using Windows default applications

M

mog

Dear Colleagues,

I want to open a file from an Acess form using the registered default
Windows application, just as if I were to double-click on the file name
in Windows Explorer or click Start, Run, and enter the file path and
name. I want to use a shortcut menu; so if I select the command on a
..jpg file, the Windows default jpg editor opens the file. If I select
the command on a .xls file, I want Excel to opent the spreadsheet.

I tried the Shell command but it doesn't work.

with kind regards,

mog
 
R

RoyVidar

mog wrote in message said:
Dear Colleagues,

I want to open a file from an Acess form using the registered default Windows
application, just as if I were to double-click on the file name in Windows
Explorer or click Start, Run, and enter the file path and name. I want to use
a shortcut menu; so if I select the command on a .jpg file, the Windows
default jpg editor opens the file. If I select the command on a .xls file, I
want Excel to opent the spreadsheet.

I tried the Shell command but it doesn't work.

with kind regards,

mog

The Shell function should normally work, though it would need quoting
etc if there are spaces or special characters in the path - it is
usually
recommended to add errornumber/messages and the bombing code
to the question, as it will help when assisting.

But you could have a look at this wrapper for he ShellExecute API
http://www.mvps.org/access/api/api0018.htm
 
M

mog

Thanks Roy, solves the problem. The SellExecute wrapper works a treat.
Exactly what I wanted. Many many thanks!
 
Top