action button to start a macro???

  • Thread starter Thomas Lindberg
  • Start date
T

Thomas Lindberg

Ppt2003 and Ppt2007, same problem:

I have a macro that does what I expect when I run it from inside VBA, no
problem.
I have an Acton button that is set to run that macro when clicked: The macro
does NOT run when button clicked
Changing the action to Play sound works OK, sound played when button
clicked
File saved as .pptm in Ppt2007 and as .ppt in Ppt2003

Realize that there is a setting somewhere to enable the macro to run but I
can't find it.

A humble request for HELP!!


Thomas
 
D

David Marcovitz

There are a few things that could be a problem:

(1) Action buttons only work in Slide Show View so if you are clicking
the action button in Normal view, it won't work. This doesn't seem to be
the problem as your sound plays.

(2) Many macros that work in Normal view (like when you tried to run it
from the VBA editor) won't work in Slide Show view. This is especially a
problem for macros recorded with the macro recorder. The macro recorder
likes to do things that can't be done during the slide show, like
selecting an object. Perhaps, if you post some code we could have a look.

--David
 
T

Thomas Lindberg

David,

Here is the macro:

Sub ToggleVisibility()
ActiveWindow.Selection.SlideRange.Shapes("Text Box 5").Visible =
msoTriStateToggle
End Sub

The idea is that a Action button on/near an object during a slide show
shall toggle the visibility of a textbox providing help/more info for that
object .

I am aware of what you say below, should have told the full story as per
above!

This is my first try in VBA for Ppt but I have used macros in Word and Excel
since macros and VBA was introduced,
seems to be at least one big first step to climb to use them in Ppt!


Thomas
 
D

David Marcovitz

OK. Now we are getting somewhere. Macros in PowerPoint are much
different than macros in Word and Excel, partly because PowerPoint has
to deal with Normal view and Slide Show view. Anything with "Selection"
or "Select" in the macro will not work in Slide Show View. Try this
instead:

ActivePresentation.SlideShowWindow.View.Slide.Shapes("Text Box
5").Visible = msoTriStateToggle

Everthing in that line up to (but not including) the .Shapes is just a
fancy way to refer to the current slide in Slide Show View.
Alternatively, you could specify the exact slide:

ActivePresentation.Slides(3).Shapes("Text Box 5").Visible =
msoTriStateToggle

That will work for Slide 3 no matter what the current slide is.

--David
 
T

Thomas Lindberg

Thanks to David for nailing my problem and to Steven for the continuation I
have in mind but not tried because of the base problem!!


Thomas
 

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