Results 1 to 6 of 6
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    add a toolbar to a template other than Normal.dot?

    How to add a toolbar to a template other than Normal.dot?

    The code below does a bang-up job of adding a toolbar, but the toolbar ends up in Normal.dot, and I destroy (on purpose) my Normal.dot at the end of each session.

    The code below is in a template Under.dot, which is locked, so I'm really interested in having the code add the toolbar into another, modifiable template.


    <pre>Public Function boolCreateToolbar(strToolbar As String) As Boolean
    ' Procedure : boolCreateToolbar
    ' Description: Create a toolbar.
    ' Copyright: Chris Greaves Inc.
    ' Inputs: STRING name of toolbar
    ' Returns: None.
    ' Assumes: None.
    ' Side Effects: None
    ' Tested: By the calls below.

    CommandBars.Add(Name:=strToolbar).Visible = True
    End Function
    Sub TESTboolCreateToolbar()
    MsgBox boolCreateToolbar("b")
    End Sub
    </pre>


  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: add a toolbar to a template other than Normal.dot?

    Hi Chris,
    I think what you're after is CustomizationContext - this will allow you to specify where you want the new commandbar added.
    Hope that helps.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: add a toolbar to a template other than Normal.dot?

    Rory - T H A N K S !

    This was driving me crazy.

    I continue to be staggered by the flexibility of VBA that seems to be hidden from me. despite my scouring of the Help files, wandering down sundry paths, I missed this one.

  4. #4
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: add a toolbar to a template other than Normal.dot?

    Chris,
    The Help files are great when:
    a) they work at all.
    [img]/forums/images/smilies/cool.gif[/img] you know exactly what you're looking for.
    c) you have a few spare hours to wander off track admiring the scenery and filing away bits of info that you'll never need unless you don't file them away, in which case you'll never be able to find them again.
    d) you're just trying to find the particular syntax of a statement (except when they adamantly tell you to enclose your arguments in parentheses even though this is the one thing that will prevent your code from working)
    e) Various combinations of the above.
    Still, at least I'm not bitter.
    Regards,
    Rory

    Microsoft MVP - Excel

  5. #5
    5 Star Lounger
    Join Date
    Dec 2000
    Location
    Reading/Swindon, Berkshire, United Kingdom
    Posts
    664
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: add a toolbar to a template other than Normal.dot?

    Rory,

    That's an absolutely brilliant summation of ms help files. Give yourself a star is what I say!

    Brooke

  6. #6
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: add a toolbar to a template other than Normal.dot?

    Brooke,
    Thanks - I would but I don't moderate this forum!
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

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