All guru,
Below is the code I have written in VBA for creating a toolbar and using it whenever opening file a called MyWorkbook.xls file.
Problem is when I close myworkbook.xls file the custom toolbar is still available. I right clicked at the toolbar and can see the custom toolbar created by me.
How to delete custom toolbar when closing excel file.
Code in This Workbook
Private Sub Workbook_WindowActivate(ByVal Wn As _
Excel.Window)
If Application.CommandBars("Tool").Visible = True Then
Exit Sub
Else
Application.CommandBars("Tool").Visible = True
End If
End Sub
Private Sub Workbook_WindowDeactivate(ByVal Wn As _
Excel.Window)
If Application.CommandBars("Tool").Visible = True Then
Application.CommandBars("Tool").Visible = False
Exit Sub
Else
Exit Sub
End If
End Sub
Below is the code I have written in VBA for creating a toolbar and using it whenever opening file a called MyWorkbook.xls file.
Problem is when I close myworkbook.xls file the custom toolbar is still available. I right clicked at the toolbar and can see the custom toolbar created by me.
How to delete custom toolbar when closing excel file.
Code in This Workbook
Private Sub Workbook_WindowActivate(ByVal Wn As _
Excel.Window)
If Application.CommandBars("Tool").Visible = True Then
Exit Sub
Else
Application.CommandBars("Tool").Visible = True
End If
End Sub
Private Sub Workbook_WindowDeactivate(ByVal Wn As _
Excel.Window)
If Application.CommandBars("Tool").Visible = True Then
Application.CommandBars("Tool").Visible = False
Exit Sub
Else
Exit Sub
End If
End Sub