Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Aug 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Creating command bar only in the current active do (2000)

    <font face="EraserDust">Dust</font face=dust> Hello All,

    I need some help. Here is my problem. Thru' an add-in, I have created a command bar with custom buttons (say for example "Open" and "Close"). This appears in all the document windows in word... fine! Onclick of "open" button I want to create another command bar, specifically for the current active document (ie., if I open another document window in word the new command bar should not be there).
    So, please tell me, in word, how to create a command bar only in the current active document (and not for all other document windows in word). Any replies will be greatly appreciated.
    Thanks in advance for the replies

    Regards <img src=/S/confused.gif border=0 alt=confused width=15 height=20>

  2. #2
    Super Moderator
    Join Date
    Jan 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    3,852
    Thanks
    4
    Thanked 259 Times in 239 Posts

    Re: Creating command bar only in the current active do (2000)

    The easiest way would be to attach a template to that particular file and not to others. The toolbar should be located in that template.
    Andrew Lockton, Chrysalis Design, Melbourne Australia

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Creating command bar only in the current active do (2000)

    Immediately before creating the commandbar, you set the CustomizationContext:

    CustomizationContext = docTargetDocumentOrTemplate
    Set cbarNew = CommandBars.Add("My New Toolbar", msoBarTop, , False)

    Now... I am reasonably certain that an object reference to the correct document, will work, but I haven't ever tested it in that form.

  4. #4
    New Lounger
    Join Date
    Aug 2002
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Creating command bar only in the current active do (2000)

    It does work jscher2000
    Thanks

Posting Permissions

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