View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default How to use the content of a cell as a file name

A typo.

Try:
ActiveSheet.Pictures.Insert(sName).Select



cyrus wrote:

Tom,
I'm so close to getting this right but not there yet. I tried your code and
I get this message" Unable to get the property of the pictures class"
My thinking is that I have the wrong file name in the cell. but checked and
double checked. I even ran the recorded macro to see the exact file and it
maches with my cell. Any ideas?

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("3").Range("G43").Text
ActiveSheet.Pictures.Insert(s).Select """ this is highlighted""""
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

--
CY

"Tom Ogilvy" wrote:

http://www.mcgimpsey.com/excel/lookuppics.html

If that isn't exactly what you want, it should give you all the information
you need.

if you want your simplified code:

ActiveSheet.Unprotect
Range("E2:H18").Select
sName = Worksheets("Sheet1").Range("A1").Text
ActiveSheet.Pictures.Insert(s).Select

Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#


--
regards,
Tom Ogilvy


"cyrus" wrote in message
...
I Like to have a macro that looks at the content of a specific cell in the
sheet to get the file name neede to insert the picture in a specific cell.
This would be same function for all the sheets except sheet(cover).
Here is the recorded macro:
ActiveSheet.Unprotect
Range("E2:H18").Select
ActiveSheet.Pictures.Insert( _ """" this is where I want to unsert the
cell that has file name"""'
"C:\Documents and Settings\Vince Aragona\My Documents\My
Pictures\101MSDCF\101MSDCF\DSC00002.JPG" _
).Select
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 216#
Selection.ShapeRange.Width = 288#
Selection.ShapeRange.Rotation = 0#

Any help would be greatly appreciated.
--
CY





--

Dave Peterson