Addin that puts macro functionality to every slideshow

  • Thread starter Hans-Peter Pflaum
  • Start date
H

Hans-Peter Pflaum

Hi all,

I need to have an addin that puts on every presentation that is opened a button on the
slidemaster. Associated with a macro that shows a little dialog to allow my instructors to
give a feedback on that slide. (I need to have that in Slideshow mode, therefore a Menu button won't do...)

I coded the macro "AddFeedback" along with "Auto_Open" and "Auto_Close" and saved it as .ppa addin.
There are two problems I face:
- When PPT starts the addin is loaded prior to the presentation, therefore the button doesn't load in the presentation. I tried the sleep(<time>) but that seemed to pause ppt completely.
- If I manage to load the addin manually when the presentation is already open, the button is placed. But the "AddFeedback" macro isn't run when clicking on it. (It seems not to be visible from the presentation)

ActivePresentation.SlideMaster.Shapes.AddShape(msoShapeActionButtonInformation, 0#, 0#, 16#, 16#).Select
With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick)
.Run = "AddFeedback" ' Tried also Feedback.ppa!AddFeedback
.SoundEffect.Type = ppSoundNone
.AnimateAction = msoTrue
End With

When having the macros locally in the presentation file and calling the Auto_Open/Close manually it works fine.

Thanks in advance for any hints

HaPe
 
S

Shyam Pillai

The issue here is: Auto_open runs when the add-in is loaded and it runs only
once. It does not run when a presentation is open.. To run the macro whenver
a presentation is opened, you need to tap into the PowerPoint events and
look for the Open event and call the macro when that event occurs. You will
find the an eventhandler demo and code available on www.pptfaq.com in the
programming section which will aid you.
 
H

Hans-Peter Pflaum

Shyam,

thanks so far. I went for the event handler and that part seems to work now.
The second issue is still unresolved:
The button is added but the macro isn't run, seems to be invisible by the presentation to
which the addin has posted the button with the macro call:

ActivePresentation.SlideMaster.Shapes.AddShape(msoShapeActionButtonInformation, 0#, 0#, 16#, 16#).Select
With ActiveWindow.Selection.ShapeRange.ActionSettings(ppMouseClick)
.Run = "AddFeedback" ' Tried also Feedback.ppa!AddFeedback
.SoundEffect.Type = ppSoundNone
.AnimateAction = msoTrue
End With

Regards HaPe
 
H

Hans-Peter Pflaum

I finally solved it. Maybe it's not the smartest solution but it works:
Created an addin that has:
- an event handler loaded with auto_open
- on documentOpen event run vba code that adds the macro call and the button to the ppt
- on documentClose event remove that stuff from the presentation

The presentation then can run the macro from the ppa, cause the calling routine is local in the presentation.

--
Regards
HaPe
We are rich only through what we give,
and poor only through what we refuse.
Anne Swetchine (1782-1857)
 

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