PDA

View Full Version : Code for Add Ins not working in Auto_Open



ABrown
04-11-2008, 06:40 AM
I have the following code which should, when I open my template, run the Auto_Open commande in the Add In called Milbank Template.pot, but it isn't working. Basically I want the Milbank Template.ppa to run when this particular template is open. What it was doing is run everytime I opened PowerPoint, therefore disabling the Insert menu for all presentations, not just those run from the template. This is the code I have that should now disable the Add Ins and only load the Add Ins for the template if it is opened from the template, but it is not working.

This is the code I have so far:



AddIns.Remove ("Milbank Template.ppa")
AddIns.Remove ("Normal.ppa")
If Application.ActivePresentation.TemplateName = "Milbank Template.Pot" Then
Set myAddIn = Application.AddIns.Add(FileName:="D:\Documents and Settings\abrown3\Application Data\Microsoft\AddIns\Milbank Template.ppa")
myAddIn.Loaded = True
Else
Set myAddIn = Application.AddIns.Add(FileName:="D:\Documents and Settings\abrown3\Application Data\Microsoft\AddIns\Normal.ppa")
myAddIn.Loaded = True
End If

Call Delete

Dim oToolbar As CommandBar

Dim oButton As CommandBarButton


Dim MyToolbar As String
' toolbar name
MyToolbar = "Milbank"
.....



Can anyone throw any light on what I might be doing wrong. Normal.ppa is just a normal blank presentation with no code etc.

Thanks

Annette

Tommy
04-13-2008, 12:37 PM
I think you should have it in the template itself. The Milbank Template.Pot will not actually be opened, a ppt file will be opened based off of the pot file. :)

ABrown
04-14-2008, 12:27 AM
Thanks Tommy - I do have it in the template that is why I am baffled that it is not working. When a ppt is run from the template the Auto Open should run with the Milbank Template.ppa add in which contains the same code. I have read somewhere that it has to be done using registry keys but I don't know enough about the Add Ins work with PowerPoint to know whether this is the solution.

Are there any PowerPoint experts that know the answer to this problem. Basically I just need a toolbar to load and to disable the insert menu when the template opens, without it happening when I open all the other PowerPoint documents not based on this template! Word is so much easier!

John Wilson
04-18-2008, 01:42 PM
Auto_Open needs to be in an Add In to run.

ABrown
04-21-2008, 08:07 AM
Thanks - all sorted now.