Changing pictures

M

MPR

Hi,

Is there any way of creating a VBA code to change a picture in PowerPoint, for example, there is a picture of a clipart, then I would like to call a macro to change that image loading from a image file.
In fact I would like to have an object like a GIF animated, but the picture would change only if the mouse was passed over the image.

Thanks in advance
Cesar
 
B

Bill Dilworth

Hi Cesar,

Just as a suggestion, you may want to post in plain text only since some of
our regulars do not accept messages in html for security reasons.

You need to be a bit fancy to get this sort of mouse over effect using
moving/still GIF's. Here are the steps.

1) Insert and position the motion image GIF file onto the slide.
2) Right click on the GIF and save picture as a PNG on the desktop
3) Insert the new PNG and position exactly over the GIF
4) Enter the following code: (If you need help with this see
http://www.rdpslides.com/pptfaq/FAQ00033.htm)

--------- Start Code ---------
Sub ShowIt()
'Slide where images are
Const Sld As Integer = 1

'Name of the PNG picture
Const Shp As String = "Picture 6"

'Command to make the PNG show
ActivePresentation.Slides(Sld) _
.Shapes(Shp).Visible = True
End Sub


Sub HideIt(oShp As Shape)
'Command to hide the PNG
oShp.Visible = False
End Sub
--------- End Code ---------

5) Right click on the PNG (the still picture) and select action setting
6) Select the mouse over tab
7) Assign the HideIt under the macro heading
8) Align the two pictures exactly over top of one another
9) Draw a square that is larger than the images
10 ) Assign it the ShowIt mouse over action setting (like steps 5-7)
11) Send the square behind the stacked pictures and make sure it is larger
than the picture on all sides.
12) Optionally, set the fill to background or something that blends well.

When the mouse is over the PNG (still image of the GIF) it will hide it and
allow the GIF to be seen. When the mouse moves off the GIF and passes over
the square around the images, it causes the PNG to be re-displayed.

If you would like a sample, I'll direct email you. Post back if any of this
isn't clear or you need addition instruction.


--
Bill Dilworth
A proud member of the Microsoft PPT MVP Team
Users helping fellow users.
http://billdilworth.mvps.org
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
yahoo2@ Please read the PowerPoint
yahoo. FAQ pages. They answer most
com of our questions.
www.pptfaq.com
..
..


Hi,

Is there any way of creating a VBA code to change a picture in PowerPoint,
for example, there is a picture of a clipart, then I would like to call a
macro to change that image loading from a image file.
In fact I would like to have an object like a GIF animated, but the
picture would change only if the mouse was passed over the image.

Thanks in advance
Cesar
 

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