Replacing Picture/Shape

Roderick_E

Well-known Member
Joined
Oct 13, 2007
Messages
2,051
Trying to replace a picture/shape in one spreadsheet with one in another.

Code:
'loop through all images
For Each s In wbk.Sheets(1).Shapes
[COLOR=#ff0000][B]s.picture = loadpicture(ThisWorkbook.Sheets(1).Shapes("Picture 1").Picture)[/B][/COLOR]
Next

It fails on the red line: Object doesn't support this property or method. I thought I could change all the pics this way. Ideas? Thanks
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hi

From the help:

LOADPICTURE([filename] [,widthdesired] [,heightdesired] [,flags])

Loads a picture from a file into a Picture or Image control (IPictureDisp).

Loadpicture() expectos the pathname of a file.

If I understand correctly you are just trying to copy a picture already in the workbook.

Try:
- delete the first picture
- copy the new picture to where the first picture was
 
Upvote 0
Hi

From the help:



Loadpicture() expectos the pathname of a file.

If I understand correctly you are just trying to copy a picture already in the workbook.

Try:
- delete the first picture
- copy the new picture to where the first picture was

Thanks for the reply. I came to these same conclusions and have taken the method you describe.
 
Upvote 0

Forum statistics

Threads
1,223,713
Messages
6,174,043
Members
452,542
Latest member
Bricklin

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