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

  • Thread starter Thread starter TexWolf
  • Start date Start date
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?
 
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.
 
I know how to get ths Shell function to launch a program, but how do I get it
to open the file?
 
ShellExecute will use whatever application's associated with the file
extension, which isn't what TextWolf's asking for.
 
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.
 
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.
 
Back
Top