Enable/Disable Add-in

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All

I've created an add-in for ppt 2002

I'd like to enable / disable it depending on whether a presentation is open
or not. Is there an easy way to do this?

Thanks

Trevor
 
Hi All

I've created an add-in for ppt 2002

I'd like to enable / disable it depending on whether a presentation is open
or not. Is there an easy way to do this?

Simplest is to have your code do something like:

If Windows.Count = 0 Then
' No presentations
' Optionally ...
MsgBox ("Open a presentation then try again, please.")
Exit Sub
End if

' remainder of your code follows ...
 
Thanks Steve - that'll do it.

Out of curiosity, do you know if the menu item for the Add-in can be grayed
out (therefoere not useable) until a presentation is open?

Thanks again

Trevor
 
Trevor Williams said:
Thanks Steve - that'll do it.

Out of curiosity, do you know if the menu item for the Add-in can be grayed
out (therefoere not useable) until a presentation is open?

If you implement an event handler, it should be, yes.

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

Off top of head, you'd want to trap the PresentationClose event and disable the
menu if there are no presentations active; and trap the New Presentation and
PresentationOpen events to enable the menu.

It might be enough just to work with the WindowActivate event; enable the menu if
there's a presentation active and disable it if not.
 
Splendid, I'll give it a go.

Thanks again

Steve Rindsberg said:
If you implement an event handler, it should be, yes.

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

Off top of head, you'd want to trap the PresentationClose event and disable the
menu if there are no presentations active; and trap the New Presentation and
PresentationOpen events to enable the menu.

It might be enough just to work with the WindowActivate event; enable the menu if
there's a presentation active and disable it if not.


-----------------------------------------
Steve Rindsberg, PPT MVP
PPT FAQ: www.pptfaq.com
PPTools: www.pptools.com
================================================
 
Back
Top