View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default Attaching a toolbar to a workbook

Try something like the following. Put all the code shown below in the
ThisWorkbook code module. Change "MyToolBar" to the name of your command bar
name.

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

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.CommandBars("MyToolBar").Delete
End Sub

Private Sub Workbook_Deactivate()
Application.CommandBars("MyToolBar").Visible = False
End Sub

Private Sub Workbook_Open()
Application.CommandBars("MyToolBar").Visible = True
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)


"Prixton" wrote in message
...
Hi,
I have a workbook with macros. Now I want a toolbar that appears only when
I open that specific workbook and disappears when I close the workbook. I
can not make this work as I want so if someone can help me, IŽd be very
happy. I am running Excel 2003.