Adding picture into activesheet shapes

baha17

Board Regular
Joined
May 12, 2010
Messages
183
Hi Everyone,
I a folder with 200 bmp picture and 200 image shape in sheet1.All images were named as Image1,Image2.... etc. now I would like to insert the picture into those image shapes like, for image1 load ...1.bmp, for image2 load ....2.bmp and so on.
I know how to add pictures if that images in the user form. But adding pictures to activesheet shapes gives me an error all the time. So far my code is below
'____
For i = 1 To 18
On Error Resume Next
ActiveSheet.Shapes("Image" & i).Picture = LoadPicture(ThisWorkbook.Path & "\Pictures\" & i & ".BMP")
Next i
'________

But why it's not working any idea?
Thanks in advance
baha
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
not 100% sure but is it this?:
Code:
 ActiveSheet.Shapes("Image" & i).Fill.UserPicture ThisWorkbook.Path & "\Pictures\" & i & ".BMP"
 
Upvote 0
Try something like this:-
Code:
ActiveSheet.Shapes("Image" & i).OLEFormat.Object.Object.Picture = LoadPicture(ThisWorkbook.Path & "\Pictures\" & i & ".BMP")
 
Upvote 0
Thanks for the reply p45cal but it gives "out of memory" error.
any thoughts?
Baha

What version of Excel are you using?
Could you record a macro of you doing this manually, and manipulating the image shapes a bit. This will give a clue as to what these image shapes actually are.

How did you get them onto the sheet in the first place?
 
Upvote 0
Hi,
I am using excel 2003 and 2007 at work but at home I am using2010.I add them into sheet1 at the first place.The reason is I have 250 client picture which all named as 1 to 250. Bmp file. Now I wanted to create a web page which the users can see the client picture on one web page.I try to make the webpage in word at the first time but it is too much work to do one by one.I could not write the macro for that.so that I was thinking to place 250 image shape into sheet1 but insertingpicture one by one is too much job.I admit that. Way is not the smartest but any better solution?
Bah
 
Upvote 0
Could you record a macro of you doing this manually, and manipulating the image shapes a bit. This will give a clue as to what these image shapes actually are.
 
Upvote 0
Hi p45cal
Sorry I did not see the second one at first.
ActiveSheet.Shapes("Image" & i).OLEFormat.Object.Object.Picture = _ LoadPicture(ThisWorkbook.Path & "\Pictures\" & i & ".BMP")

that one works perfectly well.
Thank you for your time. Believe me this example is one of the kind. Coz I could not find any code before on net.
Have a good day
Baha
 
Upvote 0

Forum statistics

Threads
1,224,616
Messages
6,179,911
Members
452,949
Latest member
beartooth91

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