Excel VBA - Delete toolbar

  • Thread starter Thread starter thesteelmaker
  • Start date Start date
T

thesteelmaker

I have created a toolbar, "My Details", with a some marcos in. To ope
some userforms.

The toolbar "My Details" is attached to an Excel file "my work.xls"
and appears when this file is opened.

But the toolbar is still there when i close "my work.xls".

I would like to be able to delete the toolbar after "my work.xls" ha
been closed.

Or have the toolbar only appear when "my work.xls" is open.

Any help.
Thanks
 
Try adding his code into the ThisWorkbook code module

Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars("My Details").Delete
On Error GoTo 0
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top