Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default open image file from cell value

Hi
I want to be able to open an image file (jpg) based on the value of a cell.
I got as far as:
Sub OpenFileButton1_Click()
Workbooks.Open "C:\myfiles" & ActiveSheet.Range("C2").Value
End Sub

which opens an xls file (e.g. 1.xls) in the c:\myfiles folder. but what
code should I be using if I want to open e.g. 1.jpg in the same folder
Thanks for all your help!
--
---------
Gareth
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default open image file from cell value

Tried this too, from advice on a google forum, but didn't work:

Sub OpenFileButton1_Click()

Dim Picture As String
Picture = "C:\myfiles\" & ActiveSheet.Range("C2").Value

Shell ("Start " & Picture)
End Sub

Any ideas?
Ta
--
---------
Gareth


"el_peacock" wrote:

Hi
I want to be able to open an image file (jpg) based on the value of a cell.
I got as far as:
Sub OpenFileButton1_Click()
Workbooks.Open "C:\myfiles" & ActiveSheet.Range("C2").Value
End Sub

which opens an xls file (e.g. 1.xls) in the c:\myfiles folder. but what
code should I be using if I want to open e.g. 1.jpg in the same folder
Thanks for all your help!
--
---------
Gareth

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default open image file from cell value

Try this,

Sub OpenFileButton1_Click()
Dim Picture As String
Dim RETVAL
Picture = "C:\myfiles\" & ActiveSheet.Range("C2").Value
RETVAL = Shell("EXPLORER " & Picture, 1)
End Sub

Regards,
Shah Shailesh
http://in.geocities.com/shahshaileshs/
(Excel Add-ins Page)

*** Sent via Developersdex http://www.developersdex.com ***
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default open image file from cell value


el_peacock Wrote:
Hi
I want to be able to open an image file (jpg) based on the value of a
cell.
I got as far as:
Sub OpenFileButton1_Click()
Workbooks.Open "C:\myfiles" & ActiveSheet.Range("C2").Value
End Sub

which opens an xls file (e.g. 1.xls) in the c:\myfiles folder. but
what
code should I be using if I want to open e.g. 1.jpg in the same folder
Thanks for all your help!
--
---------
Gareth


In my application I want the image to be picked up from a folder (which
has photos of all employees stored) and display it on a small window,
the position and size of which is defined. When I select any row on the
sheet it picks up the employee code from a particular cell uses that to
concatenate the file name and fetches that picture and displays in the
predifined window. I use
( you seem to have missed \ after myfiles, it should be "c:\myfiles\"
&..And cell C2 must have full file name with extension .jpg ( eg.
smith.jpg ) else you need to concantenate that also the way I have done
below)
Filename ="c:\myfiles\" & ActiveSheet.Range("C2") & ".jpg"
ActiveSheet.Shapes.AddPicture Filename, False, True, 460, 12, 130, 130

A V Veerkar


--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338
View this thread: http://www.excelforum.com/showthread...hreadid=509963

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default open image file from cell value

Hi
how can I use same code but to show all Photos in cell "C"

C1
C2
C3
C4
C5

ETC....

"avveerkar" wrote:


el_peacock Wrote:
Hi
I want to be able to open an image file (jpg) based on the value of a
cell.
I got as far as:
Sub OpenFileButton1_Click()
Workbooks.Open "C:\myfiles" & ActiveSheet.Range("C2").Value
End Sub

which opens an xls file (e.g. 1.xls) in the c:\myfiles folder. but
what
code should I be using if I want to open e.g. 1.jpg in the same folder
Thanks for all your help!
--
---------
Gareth


In my application I want the image to be picked up from a folder (which
has photos of all employees stored) and display it on a small window,
the position and size of which is defined. When I select any row on the
sheet it picks up the employee code from a particular cell uses that to
concatenate the file name and fetches that picture and displays in the
predifined window. I use
( you seem to have missed \ after myfiles, it should be "c:\myfiles\"
&..And cell C2 must have full file name with extension .jpg ( eg.
smith.jpg ) else you need to concantenate that also the way I have done
below)
Filename ="c:\myfiles\" & ActiveSheet.Range("C2") & ".jpg"
ActiveSheet.Shapes.AddPicture Filename, False, True, 460, 12, 130, 130

A V Veerkar


--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338
View this thread: http://www.excelforum.com/showthread...hreadid=509963




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default open image file from cell value

hi Akader

See this site
http://www.mcgimpsey.com/excel/lookuppics.html

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Akader" wrote in message ...
Hi
how can I use same code but to show all Photos in cell "C"

C1
C2
C3
C4
C5

ETC....

"avveerkar" wrote:


el_peacock Wrote:
Hi
I want to be able to open an image file (jpg) based on the value of a
cell.
I got as far as:
Sub OpenFileButton1_Click()
Workbooks.Open "C:\myfiles" & ActiveSheet.Range("C2").Value
End Sub

which opens an xls file (e.g. 1.xls) in the c:\myfiles folder. but
what
code should I be using if I want to open e.g. 1.jpg in the same folder
Thanks for all your help!
--
---------
Gareth


In my application I want the image to be picked up from a folder (which
has photos of all employees stored) and display it on a small window,
the position and size of which is defined. When I select any row on the
sheet it picks up the employee code from a particular cell uses that to
concatenate the file name and fetches that picture and displays in the
predifined window. I use
( you seem to have missed \ after myfiles, it should be "c:\myfiles\"
&..And cell C2 must have full file name with extension .jpg ( eg.
smith.jpg ) else you need to concantenate that also the way I have done
below)
Filename ="c:\myfiles\" & ActiveSheet.Range("C2") & ".jpg"
ActiveSheet.Shapes.AddPicture Filename, False, True, 460, 12, 130, 130

A V Veerkar


--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338
View this thread: http://www.excelforum.com/showthread...hreadid=509963




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 21
Default open image file from cell value

Hi Ron de Bruin
I open this link and I take a look in the File, but can you tell me where
they save to photo in that file ???, I search for photos I could't find them

"Ron de Bruin" wrote:

hi Akader

See this site
http://www.mcgimpsey.com/excel/lookuppics.html

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Akader" wrote in message ...
Hi
how can I use same code but to show all Photos in cell "C"

C1
C2
C3
C4
C5

ETC....

"avveerkar" wrote:


el_peacock Wrote:
Hi
I want to be able to open an image file (jpg) based on the value of a
cell.
I got as far as:
Sub OpenFileButton1_Click()
Workbooks.Open "C:\myfiles" & ActiveSheet.Range("C2").Value
End Sub

which opens an xls file (e.g. 1.xls) in the c:\myfiles folder. but
what
code should I be using if I want to open e.g. 1.jpg in the same folder
Thanks for all your help!
--
---------
Gareth

In my application I want the image to be picked up from a folder (which
has photos of all employees stored) and display it on a small window,
the position and size of which is defined. When I select any row on the
sheet it picks up the employee code from a particular cell uses that to
concatenate the file name and fetches that picture and displays in the
predifined window. I use
( you seem to have missed \ after myfiles, it should be "c:\myfiles\"
&..And cell C2 must have full file name with extension .jpg ( eg.
smith.jpg ) else you need to concantenate that also the way I have done
below)
Filename ="c:\myfiles\" & ActiveSheet.Range("C2") & ".jpg"
ActiveSheet.Shapes.AddPicture Filename, False, True, 460, 12, 130, 130

A V Veerkar


--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338
View this thread: http://www.excelforum.com/showthread...hreadid=509963





  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default open image file from cell value

There all in Sheet1 on top of each other

If you run this

On Error Resume Next
ActiveSheet.DrawingObjects.Visible = True
On Error GoTo 0

you can drag the picture you see to another place and you see the others


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Akader" wrote in message ...
Hi Ron de Bruin
I open this link and I take a look in the File, but can you tell me where
they save to photo in that file ???, I search for photos I could't find them

"Ron de Bruin" wrote:

hi Akader

See this site
http://www.mcgimpsey.com/excel/lookuppics.html

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Akader" wrote in message ...
Hi
how can I use same code but to show all Photos in cell "C"

C1
C2
C3
C4
C5

ETC....

"avveerkar" wrote:


el_peacock Wrote:
Hi
I want to be able to open an image file (jpg) based on the value of a
cell.
I got as far as:
Sub OpenFileButton1_Click()
Workbooks.Open "C:\myfiles" & ActiveSheet.Range("C2").Value
End Sub

which opens an xls file (e.g. 1.xls) in the c:\myfiles folder. but
what
code should I be using if I want to open e.g. 1.jpg in the same folder
Thanks for all your help!
--
---------
Gareth

In my application I want the image to be picked up from a folder (which
has photos of all employees stored) and display it on a small window,
the position and size of which is defined. When I select any row on the
sheet it picks up the employee code from a particular cell uses that to
concatenate the file name and fetches that picture and displays in the
predifined window. I use
( you seem to have missed \ after myfiles, it should be "c:\myfiles\"
&..And cell C2 must have full file name with extension .jpg ( eg.
smith.jpg ) else you need to concantenate that also the way I have done
below)
Filename ="c:\myfiles\" & ActiveSheet.Range("C2") & ".jpg"
ActiveSheet.Shapes.AddPicture Filename, False, True, 460, 12, 130, 130

A V Veerkar


--
avveerkar
------------------------------------------------------------------------
avveerkar's Profile: http://www.excelforum.com/member.php...o&userid=30338
View this thread: http://www.excelforum.com/showthread...hreadid=509963







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
can we attach an image file to a excel cell ,like note pad comment PR New Users to Excel 1 January 20th 06 05:08 PM
Allow the pasting of a .jpg or other image file into a cell in Ex. Don Saunders Excel Worksheet Functions 1 January 28th 05 10:01 PM
Export the worksheet background image as an image file - possible? DataFreakFromUtah Excel Programming 2 April 10th 04 04:49 PM
Open image from web in window same size as image? Milos Setek Excel Programming 0 February 5th 04 03:33 AM


All times are GMT +1. The time now is 08:45 AM.

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

About Us

"It's about Microsoft Excel"