Hi everyone. . . long time, no post.
I'm making a Powerpoint 97 add-in to do some of the repetitive dirtywork I go through every time I export my lecture notes from Word to Powerpoint. I have the core code done, but I need to create the custom menu item that loads when the add-in loads so I can fire off my code (since you can't assign keyboard shortcuts to macros in Powerpoint).
According to Combo in thread707-635078 ,
I haven't used classes before (!), and I can't find that help file article (it's either not installed, or it was added in a later version of Powerpoint). Can someone give me some simple guidelines for coding a class that lets me access Presentation.Open and Presentation_BeforeClose events, or whatever Powerpoint calls them?
Thanks!
VBAjedi
For what it's worth, this is the code I'm trying to fire (as I would do it in Excel):
VBAjedi![[swords] [swords] [swords]](/data/assets/smilies/swords.gif)
I'm making a Powerpoint 97 add-in to do some of the repetitive dirtywork I go through every time I export my lecture notes from Word to Powerpoint. I have the core code done, but I need to create the custom menu item that loads when the add-in loads so I can fire off my code (since you can't assign keyboard shortcuts to macros in Powerpoint).
According to Combo in thread707-635078 ,
You can use Application events, see "Using Events with the Application Object" in PP VBA help file. As in other office applications, you have to create new class to handle events and initialise it. After that, SlideShowBegin and other events can be trapped.
I haven't used classes before (!), and I can't find that help file article (it's either not installed, or it was added in a later version of Powerpoint). Can someone give me some simple guidelines for coding a class that lets me access Presentation.Open and Presentation_BeforeClose events, or whatever Powerpoint calls them?
Thanks!
VBAjedi
For what it's worth, this is the code I'm trying to fire (as I would do it in Excel):
Code:
Private Sub Workbook_Open()
Dim MenuObject As CommandBarPopup
Dim MenuItem As CommandBarButton
For Each MenuObject In Application.CommandBars(1).Controls
If MenuObject.Caption = "C&ustom Tools" Then MenuObject.Delete
Next MenuObject
Set MenuObject = Application.CommandBars(1). _
Controls.Add(Type:=msoControlPopup, Temporary:=True) ' Before:=PositionOrMacro,
With MenuObject
.Caption = "C&ustom Tools"
Set MenuItem = .Controls.Add(Type:=msoControlButton)
With MenuItem
.Caption = "&Animate All"
.OnAction = "AnimateAll"
End With
Set MenuItem = .Controls.Add(Type:=msoControlButton)
With MenuItem
.Caption = "&About Custom Tools"
.OnAction = "ShowAbout"
.BeginGroup = True ' Adds divider line
End With
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
Dim MenuObject As CommandBarPopup
For Each MenuObject In Application.CommandBars(1).Controls
If MenuObject.Caption = "C&ustom Tools" Then MenuObject.Delete
Next MenuObject
End Sub
VBAjedi
![[swords] [swords] [swords]](/data/assets/smilies/swords.gif)