Consulting

Results 1 to 5 of 5

Thread: Code for Add Ins not working in Auto_Open

  1. #1
    VBAX Regular
    Joined
    Feb 2008
    Posts
    58
    Location

    Code for Add Ins not working in Auto_Open

    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:

    [VBA]

    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"
    .....

    [/VBA]

    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

  2. #2
    Moderator VBAX Master Tommy's Avatar
    Joined
    May 2004
    Location
    Houston, TX
    Posts
    1,184
    Location
    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.

  3. #3
    VBAX Regular
    Joined
    Feb 2008
    Posts
    58
    Location

    Code for Add Inn not working in Auto Open

    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!

  4. #4
    VBAX Master
    Joined
    Feb 2007
    Posts
    2,093
    Location
    Auto_Open needs to be in an Add In to run.
    John Wilson
    Microsoft PowerPoint MVP
    Amazing Free PowerPoint Tutorials
    http://www.pptalchemy.co.uk/powerpoi...tutorials.html

  5. #5
    VBAX Regular
    Joined
    Feb 2008
    Posts
    58
    Location
    Thanks - all sorted now.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •