Opening an External Program with access vba

G

Guest

Hello i have to open an external program.but the problem is that i dont have
to open the executable itself. i have shape files and using arcview explorer
to view it. i m using the following command


Dim stAppName As String

stAppName = "C:\ESRI\ESRIDATA\visionpakistan.apr"
Call Shell(stAppName, 1)

but when i run this command an error occurs "invalid procedure call or
argument".
i put this file in command prompt and then run it the file succesfully
opened in its program.
any idea??
 
R

Roger Carlson

The Shell function requires an executable program (.exe, .bat, and so forth)
as an argument. Apparently, there is an application associated with the
..APR extention, so you should be able to use that. Something like:

stAppName = "C:\Program Files\ESRI\ESRI.exe
C:\ESRI\ESRIDATA\visionpakistan.apr"

This assumes the program is called ESRI.exe and is in the Program Files
folder.


--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
A

Albert D. Kallal

just use:

application.FollowHyperlink "C:\ESRI\ESRIDATA\visionpakistan.apr"

The above will open the file based on its extension (pdf, word,
execl...etc...will ALL work).

You don't need the path to the executable part...
 
G

Guest

Application.fllowhyperlink works fine. but still there is a little problem. a
pop appears, which says
"
Openinig c:\....
Some Files can Contain Viruses or otherwise be harmful to your computer. It
is import..........
would you like to open this file?
ok/Cancel"
can you please tell me how to disable this dialog box. i tried to use
setwarnings= false. but its not working here
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top