Insert Photo - help

S

Stevep4

My previous questions were in regard to importing a picture from a remote
directory based upon another cell contents etc.. Perhaps this is too
complicated for a first step for me to digest.

So lets try an easy one as a starter.

I have the photo "LG.jpg" located in my C:\ drive.

I want this photo inserted into cell A2.

what code should I use??

I am running excel 2000
 
G

Gord Dibben

First of all you cannot insert a picture "into" a cell.

You can insert a picture into a worksheet on top of a cell.

Turn on the macro recorder while you go to Insert>Picture>From File

You get this..............

Sub Macro1()
ActiveSheet.Pictures.Insert("C:\BG11.jpg").Select
End Sub

Placement and re-sizing etc can be done during the same recording to get
stuff like this which kinda sets it over A2.............

ActiveSheet.Pictures.Insert("C:\BG11.jpg").Select
Selection.ShapeRange.IncrementLeft -241.5
Selection.ShapeRange.IncrementTop -61.5
Selection.ShapeRange.ScaleWidth 0.21, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.21, msoFalse, msoScaleFromTopLeft
Selection.ShapeRange.ScaleHeight 0.45, msoFalse, msoScaleFromTopLeft


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top