Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
can we attach an image file to a excel cell ,like note pad comment | New Users to Excel | |||
Allow the pasting of a .jpg or other image file into a cell in Ex. | Excel Worksheet Functions | |||
Export the worksheet background image as an image file - possible? | Excel Programming | |||
Open image from web in window same size as image? | Excel Programming |