ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Insert Photo - help (https://www.excelbanter.com/excel-discussion-misc-queries/216807-insert-photo-help.html)

Stevep4

Insert Photo - help
 
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

Gord Dibben

Insert Photo - help
 
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 InsertPictureFrom 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

On Fri, 16 Jan 2009 15:32:00 -0800, Stevep4
wrote:

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




All times are GMT +1. The time now is 02:05 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com