0
votes

I am an extreme newbie with vba, so please forgive my newbieness, and please be gentle with me, thank you.

I need some help.

How do I import images into an existing presentation.

All my slides have text on them. I simply want to import 1 image per slide as a back drop. I feel really silly - as this seems like a very ordinary task that should be in PPT but as far as i know - I cant seem to get anything to work.

I would like each image I import to be the back drop of the content on the slide.

I have looked all over for months and nothing has worked.

This macro does a good job of importing the images only

http://www.pptfaq.com/FAQ00352_Batch_Insert_a_folder_full_of_pictures-_one_per_slide.htm

Code below adds the image and slide

Do While strTemp <> ""
Set oSld =   ActivePresentation.Slides.Add(ActivePresentation.Slides.Count  + 1, ppLayoutBlank)
Set oPic = oSld.Shapes.AddPicture(FileName:=strPath & strTemp, _
LinkToFile:=msoFalse, _
SaveWithDocument:=msoTrue, _
Left:=0, _
Top:=0, _
Width:=-1, _
Height:=-1)
' width/height of -1 tells PPT to import the image at its "natural" size

Can any VBA pro expert please assist me - as I have near to 300+ slides and manually fixing different images is going to be a long week of hard work.

I am very appreciative of your advice.

many thanks for your time

1

1 Answers

0
votes

After adding the picture, do this:

oPic.ZOrder(msoSendToBack)

That'll send the picture behind all the other shapes on the slide.

Note that, depending on PPT version, PPT may drop your pictures into empty content or picture placeholders on the slide rather than inserting them normally. There are ways around this, but if you're using slides w/o these placeholders, or they're there but already have content, we needn't worry about it.