Help with shell command

  • Thread starter Thread starter St
  • Start date Start date
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!
 
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.
 
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.
 
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
 
Back
Top