VBA picture from excel sheet

P

PHason

I'm working on automating a slideshow where it pulls the data in from
an excel worksheet. One of the sheets has pictures that are added to
the sheet and are named. Is it possible for me to reference those
pictures, which will always be the same name from the excel sheet and
put them on a slide through vba? I've been playing with placeholders
and then changing the background with a picture from a directory, and
that works well.


Using something like:
ActivePresentation.Slides("NewHires").Shapes("img1").Fill.UserPicture
"c:\pic.jpg"


How would I do the same thing for a picture in an excel sheet? Is it
possible, or should I be using a different method for pictures in
powerpoint? Any suggestions would be great.
 
S

Steve Rindsberg

PHason said:
I'm working on automating a slideshow where it pulls the data in from
an excel worksheet. One of the sheets has pictures that are added to
the sheet and are named. Is it possible for me to reference those
pictures, which will always be the same name from the excel sheet and
put them on a slide through vba? I've been playing with placeholders
and then changing the background with a picture from a directory, and
that works well.

Using something like:
ActivePresentation.Slides("NewHires").Shapes("img1").Fill.UserPicture
"c:\pic.jpg"

How would I do the same thing for a picture in an excel sheet? Is it
possible, or should I be using a different method for pictures in
powerpoint? Any suggestions would be great.

Can you store the path to the image file in the Excel sheet along with (or
instead of) the picture?

Or instead of using a picture-filled shape, why not copy/paste the picture into
PPT as a new shape?
 
P

PHason

Or instead of using a picture-filled shape, why not copy/paste the picture into
PPT as a new shape?

-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================

Thanks, Steve and Shyam for the responses. I'm not very adept at vba so
I wanted to stay away from having to remove the picture and replace it
each time the slideshow looped through because it seemed like it would
be too much work for placement and other considerations. What I ended
up doing is having the picture in excel get inserted into a blank
chart, then exporting the picture to a file as a picture in the same
directory, then having the code in powerpoint use those picture files
to do the .Fill UserPicture process. I'm not sure if it's the most
efficient way, but it seems to do the job well enough.
 
V

ValentinMorrisonRamos

if the desired effect was to get the images out of the excel file,
would not saving the excel out to a web page have created a folder with
all the images in it?

 
P

PHason

if the desired effect was to get the images out of the excel file,
would not saving the excel out to a web page have created a folder with
all the images in it?

I need a user form where a person can open the worksheet, push a button
under one of the pictures, change that picture, then save the
worksheet. Then powerpoint will show whatever picture was chosen by the
user. If i automated the save as part to a webpage, then the worksheet
would actually change to the new webpage file and would save as that
and the pictures it creates are named differently each time, therefore
making it more difficult to reference them in the slideshow. I wanted
it to be as automated as possible.
 

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