Help with shell command

S

St

I can't seem to google this answer. I have a button in a spreadsheet that is
supposed to open a TIFF file. There are 3-4 users, and they all have
different default applications that open the TIFF format. How can I shell
open the TIFF files with whatever the default opener for that file type?

On my computer, it looks like this:

Private Sub OpenImage(FileName)

Dim OpenImaging

OpenImaging = Shell("C:\Program Files\Windows
NT\Accessories\ImageVue\kodakimg.exe
(continue same line) K:\Imagefolder\" & FileName & ".tif", 1)

End Sub

But I know that I will not work on the other comps. Help, please!
 
G

Guest

Remember that cmd.exe has access to the file associations

You can by-pass the application and go right to the file:

x = Shell("cmd.exe /c C:\UserGuide.pdf", 1)

cmd.exe will know to use the Reader if the full Acrobat is not installed.
 
S

St

Thank you Gary's student. That should work.

Gary''s Student said:
Remember that cmd.exe has access to the file associations

You can by-pass the application and go right to the file:

x = Shell("cmd.exe /c C:\UserGuide.pdf", 1)

cmd.exe will know to use the Reader if the full Acrobat is not installed.
 
A

Adam

Hey St,

Try using the System.Windows.Froms.Application.StartUpPath to get the
path to your .exe and append the name of the .exe to the path.

Private Sub OpenImage(FileName)

Dim OpenImaging

OpenImaging = Shell(System.Windows.Froms.Application.StartUpPath &
"kodakimg.exe K:\Imagefolder\" & FileName & ".tif", 1)

End Sub
 

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