Macro to view a PNG file using paint

fraz627

Board Regular
Joined
Apr 26, 2014
Messages
102
Office Version
  1. 2010
Platform
  1. Windows
I need a macro to open a PNG file using paint, with out using a hyperlink.

the path will be C:\USERS\USER\DESKTOP\Schematics\2302-0014-0100-Schematic.png

Thanks
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Your question has absolutely nothing to do with MS Excel.
 
Upvote 0
May be I was not clear on what I wanted. l have a sheet with a column of schematic numbers ex 2302-0014-0100, when I double click on the number I would like to open the file C:\USERS\USER\DESKTOP\Schematics\2302-0014-0100-Schematic.png. Now I can configure the path, but I cannot open the file, I would prefer not to do it with out a Hyperlink.
 
Upvote 0
May be I was not clear on what I wanted. l have a sheet with a column of schematic numbers ex 2302-0014-0100, when I double click on the number I would like to open the file C:\USERS\USER\DESKTOP\Schematics\2302-0014-0100-Schematic.png. Now I can configure the path, but I cannot open the file, I would prefer not to do it with out a Hyperlink.

None of that was explained in your original posting.

I don't think that's even possible to do by double-clicking on a cell.
 
Upvote 0
None of that was explained in your original posting.

I don't think that's even possible to do by double-clicking on a cell.
Not sure why not.

This is set for Column A, change as necessary.

VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim c As Range
Set c = Intersect(Target, Range("A:A"))
If c Is Nothing Then Exit Sub
Cancel = True
Shell "mspaint " & c, vbNormalFocus
End Sub
 
Upvote 0
Not sure why not.

This is set for Column A, change as necessary.

VBA Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim c As Range
Set c = Intersect(Target, Range("A:A"))
If c Is Nothing Then Exit Sub
Cancel = True
Shell "mspaint " & c, vbNormalFocus
End Sub
Thanks that did the trick
 
Upvote 0

Forum statistics

Threads
1,217,364
Messages
6,136,118
Members
449,993
Latest member
Sphere2215

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