Light VBA in powerpoint

A

Anders Lassen

Hi all

I have gotten myself into a problem. The thing is:

I need to produce a macro which can do the following:
When i push a button/area/picture in my presentation (while in presentation
mode) I want powerpoint to insert a picture at certain place on the slide.

Furthermore it would be great to also have it insert another picture on
another slide (in the same presentation)

Can anyone help me with this macro? Or direct me to a forum that can?

Thanks
 
M

Miguel.M

Hi Anders,

You can do it without VBA.
Just place the picture where you want it to appear, apply the entrance effect
you want and then edit the "timing" - click "triggers", chose "start effect
on click of"
and chose the object you want to act as the button, from the list.

Your picture will appear only on the click, or never if you don't click.

For the other picture in the other slide, just follow the same procedure.

You can do this with any combination of objects or images.

Hope I helped

Miguel.M
 
A

Anders Lassen

Hi Miguel

You are ofcause right and I really appreciete you teaching me this. However
I can not seem get powerpoint 2007 to insert the item on another slide than
where the button is.

I can only trigger the animation with objects on the sames slide. Is there
any way I can refer to a button on another slide? Do I have to tell
Powerpoint it should be wissible for all slides?

Thank you again

Best regards
Anders
 
A

Anders Lassen

Hi again I am unsure if I just posted a reply,,,,i will try again

Thanks a lot miguel! Of cause it will be easier to do it like this. I only
have one question: How can I get it to insert a picture on another slide than
where the trigger is located? Following your steps I can only chose
triggers on the same slide as where the animation will take place.

Hope you can help

Thanks

:) Anders
 
M

Miguel.M

Anders,

In fact, there's no way (to my knowledge) to use a command to act on another
slide. If you want to duplicate the action in another slide, you also have
to duplicate
the "trigger" object.
If it is a problem for your "lay-out", for instance if you want the
"trigger" to be "invisible" over the background image, when creating this
object, go to
"Format object"/"Fill color" - and apply "background", the object will assume
the background image area just behind it, wherever it is, so only you will
know
that there is a "button".

Miguel.M
 
J

John Wilson

You can only affect a shape on a different slide with vba. You can make the
action button trigger an animation on the current slide (without vba) AND run
vba on another slide (from action settings)

You might think the code you need would be something like.

ActivePresentation.Slides(2).Shapes(3).Visible=True

Two problems, you would need more code to make it invisible again and this
code to make things visible can be unreliable in slide show mode. You may
find you don't see it until you go back to edit mode

As an alternative try this.

Give the second shape an exit animation of disappear (with previous) and
make sure this is the FIRST animation on the slide. It will never show!
Now use vba on the first button to modify this animation to "Appear"

ActivePresentation.Slides(3).Timeline.Mainsequence(1).Exit=False

(obviously change the slide number to suit.)

--

john ATSIGN PPTAlchemy.co.uk
Custom vba coding and PPT Makeovers
Free PPT Hints, Tips and Tutorials
http://www.pptalchemy.co.uk/powerpoint_hints_and_tips_tutorials.html
 
A

Anders Lassen

Once again thanks for the good comments.

I have reduced my problem to one thing. I need to push an object and then a
picture or sign appers on the sames slide. I also have of cause implemented
the "trigger" method and then it works. My problem is that that if I go some
slides back (still in presentation mode) and then run the slides again the
picture that I made appear is not there anymore. It looks like the slide
"starts over" even though presentation mode has not been interrupted.

Will this always be so? Also if I use some sort of VBA?

Steve: If I put in your vba code and the path to my picture file the
"insertandsizepicture" command is red.....Why is this.? Also how do I
adjust where on the slide the pbject should appear?

Thanks again
 
A

Anders Lassen

Hi Steve

I have two pictures which I need to be able to insert if required on every
slide at the same position every time.

Would it be easy for you to write the complete code so it just inserts the
picture into the current slide when I run the macro?

I am sorry that I am so bad at VBA!

I really appreciate your help.

Best regards
Anders
 
A

Anders Lassen

Hi Steve

I may have expressed myself wrongly. It is the same two pictures that i need
to be able to set in independently. It is basically a green check mark if
response is positive or a red one if negative. There is a box for the red
chack mark and one next to it for the green.

How would the code look?

I tried your code and copy pasted it into the VBA editor. As soon as I did
this all the lines "with each oSh in...." turned red. Should do something
else?

Best regards
 

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