![]() |
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 |
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 |
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 *** |
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 |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 07:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com