View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default deleting toolbars

I would suggest that a workbook only delete the toolbar if it is the only
workbook open created from your template. I think you could identify such
workbooks by a defined name that is present in them, but not likely in other
workbooks. For example:

Sub CloseToolBar()
Dim WB As Workbook
Dim NamesCounter As Integer
Dim Dummy As String
On Error GoTo NoName
For Each WB In Workbooks
Dummy = WB.Names("MyTemplateSpecialName").Value
NamesCounter = NamesCounter + 1
NextWB:
Next
If NamesCounter = 1 Then DoDeleteTB ''Only in this workbook
Exit Sub
NoName:
Resume NextWB
End Sub


--
Jim Rech
Excel MVP