Sub to insert images from folder n create text captions

M

Max

PPT 2003. Seeking help to automate this manual process.

I'm in a ppt with just one title slide. What I want to do is
insert as many blank slides as required,
then for each blank slide:

Go to a folder*, eg: D:\D drive\Maxh\
insert the 1st image
resize the image to a fixed size, eg:
.Height = 350
.Width = 650
position it centrally
add a textbox caption just below the image left-aligned,
bearing the name of the image inserted, eg: image1.gif
(textbox preferably to be filled black/white font, size 8 times new roman)
*folder will contain only image files

... then proceed to the next blank slide, repeat the above for the 2nd image,
and continue repeating the process until all images in that folder are
inserted.
Appreciate any insights. Thanks.
 
M

Max

Fantastic, Steve! Thanks. Works great.

If you could, how does one incorporate into your Sub ImportABunch()
the functionality to add the textbox captions for each image, re:
Perhaps some sample code for me to tinker with? Thanks
 
J

John Wilson

Try adding this AFTER you set the pic to real size (after the End With)

Set otxt = oSld.Shapes.AddTextbox(msoTextOrientationHorizontal, 0, _
oPic.Top + oPic.Height + 10, 200, 20)
With otxt.TextFrame.TextRange
'Strip of last 4 characters (.jpg)
..Text = Left$(strTemp, Len(strTemp) - 4)
..Font.Name = "Arial"
..Font.Size = 8
..ParagraphFormat.Alignment = ppAlignLeft
End With

You should also Dim otxt As Shape
 
S

Steve Rindsberg

Fantastic, Steve! Thanks. Works great.

If you could, how does one incorporate into your Sub ImportABunch()
the functionality to add the textbox captions for each image, re:

Perhaps some sample code for me to tinker with? Thanks

I see the transatlantic elves have been on the case.
 
J

John Wilson

The code elves were busy. And watch out because they've been whispering to
their colleagues the birthday elves!

;-) John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top