VBA in PowerPoint

R

RobBlue

In Word, the document itself is an object and by double clicking the
document in the Project Explorer, I can add a procedure to the
<Document.Open> event.

In PP I would like to do the same, as a user opens a presentation opening
should start the code.

Am I missing something here or does PP simply not have this option???

Thanks!

Robert
 
C

Charles Maxson

Rob,

It does but it is a bit different than Word. First, you need to name your
intial code routine "Auto_Open", then save the file as an PowerPoint Add-in.
Auto_Open is a keyword that fires automation when an Addin is loaded. Not
available on 'normal' PPTs. That said, you can hook up addional events
simliar to the way you would in Word but they need either the Auto_Open or
the user to intialize them....

Here is a sample that creates a toolbar item and hooks it up so the user can
run some code on demand.

Sub Auto_Open()
Dim ctl As CommandBarButton
Set ctl = CommandBars("Standard").Controls _
.Add(Type:=msoControlButton, Temporary:=True)
ctl.Caption = "Create a trivia slide show"
ctl.OnAction = "CreateShow"
ctl.Style = msoButtonIconAndCaption
ctl.FaceId = 59
Set ctl = Nothing

End Sub



(Note: not available in the eariler versions of PPT - should have asked what
flavor you had first :s)
 
T

Tushar Mehta

Actually, it does -- after a fashion. See Charlex Maxson's response in
the same discussion.

--
Regards,

Tushar Mehta, MS MVP -- Excel
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

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