Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 4 of 4

Thread: Create a toolbar that only shows for a specific workbook.

  1. #1
    Board Regular
    Join Date
    Mar 2002
    Posts
    82
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    Does anyone know how to creat a toolbar with a button (to activate a macro) on that will only display for a specific workbook and then remove it'self when that workbook is closed ?

    Any help appreciated....

  2. #2
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi

    If it is a Custom toolbar then you will see the code for this here:
    http://www.ozgrid.com/VBA/ExcelWorkbookEvents.htm



  3. #3
    Board Regular
    Join Date
    Mar 2002
    Posts
    82
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Dave,

    That lot looks complicated and will take a while to work through but i expect it's just what I'm looking for !!

    Thanks Dave.

  4. #4
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Here is a much simplified version that does not hide all other toolbars. Your Custom Toolbar must be attached to your Workbook to use this.


    Dim IsClosed As Boolean

    Private Sub Workbook_Activate()
    Application.CommandBars("MINE").Visible = True
    End Sub


    Private Sub Workbook_BeforeClose(Cancel As Boolean)
    IsClosed = Not Cancel
    End Sub


    Private Sub Workbook_Deactivate()
    If IsClosed = True Then
    Application.CommandBars("MINE").Delete
    Else
    Application.CommandBars("MINE").Visible = False
    End If
    End Sub


Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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