Launch a file using a program other than the one associated throug

T

TexWolf

Is there a way to program a button in Access to launch a known file into a
program other than the one associated to the file in Windows XP?
 
D

Douglas J. Steele

The only way that comes to mind would be to use the Shell function. That
will, of course, require that you know the complete path to the executable
you want to use to launch the file.
 
T

TexWolf

I know how to get ths Shell function to launch a program, but how do I get it
to open the file?
 
D

Douglas J. Steele

ShellExecute will use whatever application's associated with the file
extension, which isn't what TextWolf's asking for.
 
D

Douglas J. Steele

Depends on the executable.

Many allow you to pass the name of the file as an argument:

Dim strExecutable As String
Dim strFile As String

strExecutable = "C:\Program Files\SomeApp\app.exe"
strFile = "C:\Documents\MyFile.xyz"

Shell """" & strExecutable & """ """ & strFile & """"

That's four double quotes in a row at the beginning and end, and two sets of
three double quotes in the middle. The intent is to create

"C:\Program Files\SomeApp\app.exe" "C:\Documents\MyFile.xyz"

to handle embedded spaces in the path.
 
T

TexWolf

Awesome! It works great.
You rock!

Thanks.

Douglas J. Steele said:
Depends on the executable.

Many allow you to pass the name of the file as an argument:

Dim strExecutable As String
Dim strFile As String

strExecutable = "C:\Program Files\SomeApp\app.exe"
strFile = "C:\Documents\MyFile.xyz"

Shell """" & strExecutable & """ """ & strFile & """"

That's four double quotes in a row at the beginning and end, and two sets of
three double quotes in the middle. The intent is to create

"C:\Program Files\SomeApp\app.exe" "C:\Documents\MyFile.xyz"

to handle embedded spaces in the path.
 

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