View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default How to view graphic files from excel?

Lado,

Try the following code in the code module for the appropriate
worksheet:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim WS As Worksheet
Set WS = ActiveSheet
WS.OLEObjects("Image1").Object.Picture = _
LoadPicture(ThisWorkbook.Path & "\" & Target.Text &
".jpg")

End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Kiknadze Lado" wrote in message
...
Dear all,

Let I have excel sheet with two columns:

RefNo, Description

g1234 file1
g1235 file2
g1236 file3
...............

First column cell values connected with graphic file names from

the same
directory. This means that I have graphic files: g1234.jpg,

g1235.jpg,
g1236.jpg ....in the same directory there is opened worksheet.
I want to write program which will operate by following way:
If I will click cell with the value g1234 then I want to view

graphic file
g1234.jpg. This means that will be appeared window (maybe

Internet Explorer
window or other) there I will see graphic file g1234.jpg.

I will appreciate any your help.
Lado