Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Attaching toolbar only to one workbook (2002 2003)

    I want to attach a toolbar to a specific workbook, so that whenever I open that workbook, the toolbar is displayed, and whenever I close it, it disappears. Right now, if I attach the toolbar to the workbook, and then close it, the toolbar's still there.

    Thanks....

    Dan

  2. #2
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: Attaching toolbar only to one workbook (2002 2003)

    The best way would probably be to create it with code whenever the workbook was Open (or even active) and remove it when the workbook is closed (or even deactivated)

    MS MVP Jan Karel <!profile=Pieterse>Pieterse<!/profile> has an article you might find useful on this:Toolbars

    Steve

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Attaching toolbar only to one workbook (2002 2003)

    Create code in the Workbook_BeforeClose event in the ThisWorkbook module to delete the toolbar:

    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    On Error Resume Next
    Application.CommandBars("MyToolbar").Delete
    End Sub

    If you want to do it really nicely, you can also write code in the Workbook_Activate event to set the Visible property of the toolbar to True, and in the Workbook_Deactivate event to set Visible to False.

  4. #4
    2 Star Lounger
    Join Date
    Sep 2002
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Attaching toolbar only to one workbook (2002 2003)

    THanks all.

Posting Permissions

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