Insert images as shapes instead of pictures

RChapman9

New Member
Joined
Apr 1, 2008
Messages
32
I am creating client reports that will need up to 200 pictures. I have the code to insert them, but it brings them in as linked objects, so clients can't see them since the pictures aren't on their network.

I found some code to insert them as shapes, but I'm not advanced enough to adapt my existing code to use Shapes.AddPicture, or vice versa. Can anyone advise on how to make this change?


Code:
Function insert1(PicPath, counter1)
'Formats Column A Pictures
    With ActiveSheet.Pictures.Insert(PicPath)
        With .ShapeRange
            .LockAspectRatio = msoTrue    'If you uncomment both Width and Height lines below change to 'msoFalse'
            '.Width = 50      'Adjust to change the WIDTH of your pictures - COMMENTED OUT
            .Height = 198    'Adjust to change the HEIGHT of your pictures
        End With
        .Left = ActiveSheet.Range("B" & counter1).Left
        .Top = ActiveSheet.Range("B" & counter1).Top
        .Placement = 1
        .PrintObject = True
    End With
End Function



Thanks so much!!
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Code:
Dim p As Object
Set p = Workbooks(wbName).Sheets(stName).Shapes.AddPicture(Filename:=Path &  _
                    filename & ".jpg", LinkToFile:=False, SaveWithDocument:=True, Left:=ActiveCell.Left, _
                    Top:=ActiveCell.Top, Width:=-1, Height:=-1)

-1 sets the original size. If you know the size you want, plug it in.
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,840
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top