Cell/function manipulation

  • Thread starter Thread starter mazzarin
  • Start date Start date
M

mazzarin

Hello again,
Trying to pull pictures based of a value in a cell. They should be
named the same. For example, in cell C2, the value is A123. So this
process should retrieve C:\Images\A123.bmp However, I receive the error
'The specified file wasn't found'. I've played around with it for a
while, and tried using various code I found through searching here but
I cannot get it to work.

Thoughts?

Code below.


Dim s As Shape

With [E2]
Set s = .Parent.Shapes.AddPicture( _
"C:\Images\'" & Range("C2").Value & "'"".bmp", _
True, True, .Left, .Top, .Width, .Height)
End With
With s
.ScaleHeight 0.45, msoTrue
.ScaleWidth 0.48, msoTrue
End With
 
Try:

Dim s As Shape
With [E2]
Set s = .Parent.Shapes.AddPicture( _
"C:\Images\" & Range("C2").Value & ".bmp", _
True, True, .Left, .Top, .Width, .Height)
End With
With s
.ScaleHeight 0.45, msoTrue
.ScaleWidth 0.48, msoTrue
End With

Regards

Trevor
 
Back
Top