VBA PowerPoint 2003 - Add-ins

E

Eliz

I have a couple questions:

But first some background...I have a PowerPoint add-in that loads up a
custom toolbar with a few buttons. It is comprised of a single Module with 2
procedures...

Sub Auto_Open ()
- code that generates toolbar and icons(Button1)
End Sub

Sub Button1()
- code behind Button1
End Sub

I have changed my Registry in order to install the add-in so that it appears
in my Add-in window in PP (Tools > Add-Ins). I am doing it this way, as I am
planning on distributing this add-in to all of our users.

My toolbar pop-up code is stored in the Auto_Open routine so that it will
appear automatically when the add-in is loaded. However once I have
checkmarked the Add-in to load it into PP, the toolbar doesn't appear
automatically. I still have to manually open it (Tools > Customize).

Question: Am I missing a step???

Also, I keep seeing a lot of code to automatically install and load PP
add-ins...

Question: Where should this code reside? addins.add("c:\MyAddIn").Loaded =
true

Question: I really only need this toolbar for presentations based on a
specific template (new or existing presentations). Can I attach this add-in
just to a specific template, so I can then test for that template before
having the add-in even load?

Thank you!
 
S

Steve Rindsberg

Thanks for the nicely detailed question. I've clipped a bit out to
shorten the answer:
My toolbar pop-up code is stored in the Auto_Open routine so that it will
appear automatically when the add-in is loaded. However once I have
checkmarked the Add-in to load it into PP, the toolbar doesn't appear
automatically. I still have to manually open it (Tools > Customize).

It sounds as though at some point you've made the tool bar non-visible;
PPT will remember this even though you reload the add-in, I'm pretty
sure. I'd consider setting the toolbar's .Visible property to True in
Auto_Open
Also, I keep seeing a lot of code to automatically install and load PP
add-ins...

Question: Where should this code reside? addins.add("c:\MyAddIn").Loaded
=
true

Normally there's no need for this, as you've loaded it via the registry.
You'd use this type of code to load another add-in from your code, if you
need to do that.
Question: I really only need this toolbar for presentations based on a
specific template (new or existing presentations). Can I attach this
add-in
just to a specific template, so I can then test for that template before
having the add-in even load?

In PPT 2007, individual presentations can contain code that autoruns.
Earlier versions can't.
In earlier versions, the add-in will have to load regardless but could
test to see whether the current presentation is based on your template
before it acts.
 
J

John Wilson

You probably need to post at least some of the code that generates the
toolbar and also tell us what you did to the registry. I'm assuming you mean
youve added an autoload DWord and a path string key?
 
E

Eliz

To simplify, I have omitted using the Registry this time. I have manually
installed the Add-in into PowerPoint, it is checkmarked (Loaded), but no
toolbar.

And yes, I have a line of code for the toolbar to be set to visible...

Option Explicit

Sub Auto_Open()

Dim oToolbar As CommandBar
Dim oButton As CommandBarButton
Dim MyToolbar As String

MyToolbar = "Custom PP Tools"
Set oToolbar = CommandBars.Add(MyToolbar)
Set oButton = oToolbar.Controls.Add(msoControlButton)

With oButton
.DescriptionText = "Custom PP Button"
.Caption = "Show or Hide ID"
.OnAction = "ShowHideDocID"
.Style = msoButtonIcon
.FaceId = 52
End With

oToolbar.Visible = True

End Sub

Sub ShowHideDocID()

' declare variables
' show or hide text box

End Sub


Any help would be appreciated!! Thanks!!
 

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