Running macro from a toolbar button

  • Thread starter Thread starter Robert Leithe
  • Start date Start date
R

Robert Leithe

Hi,

QUESTION #1
I have a PowerPoint template in which I created a small
macro that simply deletes the current slide.

With this template open, I have created a new toolbar and
customized it to display only one button, and I've linked
the macro mentioned above to this button.
When I click the button the following happens:

- When the template is opened for editing: the macro runs
successfully

- When I create a new presentation based on this template:
nothing happens when I click the button. But if I go to
Tools|Macro|Macros... I can see the macro in the list and
run it succesfully.

What's wrong here?
----------------------------------------------------------
QUESTION #2
How can I make a slideshow run automatically when opened?

Sincerely
Robert Leithe
 
-----Original Message-----
You need to create an add-in instead. See:

Create an ADD-IN with TOOLBARS that run macros
http://www.rdpslides.com/pptfaq/FAQ00031.htm

Thanks, it worked :)

But one issue remains: with this add-in loaded the newly
created toolbar is displayed every time PP is started. I
would like to link this toolbar to one single PP template.
Any ideas here?

Can I edit the code to check the name of the PP template
of which the user is basing the current presentation on,
and if it's "xyz" THEN i'll sett the visible = TRUE, else
it will be FALSE? If so, how can I check which
template/document is active?
 
Thanks, it worked :)

Great!

But one issue remains: with this add-in loaded the newly
created toolbar is displayed every time PP is started. I
would like to link this toolbar to one single PP template.
Any ideas here?

Can I edit the code to check the name of the PP template
of which the user is basing the current presentation on,
and if it's "xyz" THEN i'll sett the visible = TRUE, else
it will be FALSE? If so, how can I check which
template/document is active?

I'd start here:

Make PPT respond to events
http://www.rdpslides.com/pptfaq/FAQ00004.htm

If it's PowerPoint 2000 or higher, you could try checking

ActivePresentation.TemplateName

in response to New presentation or Open presentation events; the code could set
your toolbar/menu items visible or not accordingly. You'd also have to respond
to WindowActivate and/or Deactivate (because the user might have two
presentations open and switch between them - one's based on your template,
one's not)

Or more simply, you could leave the toolbar visible but have the code behind it
simply do nothing (or give the user a message box) if the active presentation
has the wrong template applied. This would work even in PPT 97.
 
Back
Top