Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How to view graphic files from excel?

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default How to view graphic files from excel?

Or, more robust,

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim WS As Worksheet
Dim FName As String
If Not Application.Intersect(Range("A1:A10"), Target) _
Is Nothing Then
FName = ThisWorkbook.Path & "\" & Target.Text & ".jpg"
If Dir(FName) < "" Then
Set WS = ActiveSheet
WS.OLEObjects("Image1").Object.Picture = _
LoadPicture(FName)
End If
End If
End Sub


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

"Chip Pearson" wrote in message
...
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






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How to view graphic files from excel?

Make the refno a hyperlink.

Insert=Hyperlink.

--
Regards,
Tom Ogilvy

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




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How to view graphic files from excel?

Thank you all. This helped me.
Best,
Lado

"Tom Ogilvy" wrote in message
...
Make the refno a hyperlink.

Insert=Hyperlink.

--
Regards,
Tom Ogilvy

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






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I view two different excel files on two different screens? Quakeystand Excel Discussion (Misc queries) 2 March 30th 09 08:05 PM
View the latest files used in Excel T-Rex Setting up and Configuration of Excel 3 August 2nd 08 05:08 PM
Can I display various Graphic Files based on Condition? kkf718 Excel Discussion (Misc queries) 4 May 25th 06 10:19 PM
Want to view excel files in separate windows astrange Excel Discussion (Misc queries) 1 May 25th 06 12:02 AM
How canI view excel files on the taskbar? Bert Excel Discussion (Misc queries) 2 August 22nd 05 05:44 PM


All times are GMT +1. The time now is 07:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"