Help with Shell command in Excel

milantst

New Member
Joined
Nov 14, 2005
Messages
2
Hello,

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, and work on different Windows platforms (2000 NT, XP). 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 K:\Imagefolder\" & FileName & ".tif", 1)

End Sub


The button subs look like this:

Private Sub Label1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Label1.SpecialEffect = 2

End Sub

Private Sub Label1_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Label1.SpecialEffect = 1
OpenImage ("Pic062")

End Sub


But I know that I will not work on the other comps. The answer should work in Excel VB.

Help, please!
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Why not use a hyperlink to open the file, instead of Shell?
 
Upvote 0
Norie said:
Why not use a hyperlink to open the file, instead of Shell?

That is a very good suggestion, it works and it's simpler than the buttons idea.

But how do I get rid of the following message:

"Some files can contain viruses or otherwise be harmful to your computer, etc. Would you like to open this file?"
 
Upvote 0

Forum statistics

Threads
1,196,073
Messages
6,013,269
Members
441,758
Latest member
Abren

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top