delete toolbar on workbook close

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to delete a toolbar when a workbook is closed.
I have two custom toolbars that I am using.
First a toolbar opens when I open a workbook.
When some macros are run, another workbook is created - call it "New" (for
purpose of this explanation.
After a series of macros run, a second toolbar is created. I would like the
second toolbar to be deleted when "New" is closed. My attempts to use
workbook_beforeClose and workbook_deactivate are failing.

I would appreciate any help.
TIA
 
Depends upon what the toolbar is called, but it would go in the BeforeClose
event, something along the lines of

Application.Commandbars("myToolbar").Delete

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
I understand what line to use. Where I am struggling is where to put the
line. I have tried creating a new routine called workbook_beforeclose in
thisworkbook but that doesn't work. I have also tried creating a
workbook_deactivate routine. Either these are not the right options, they
don't belong in thisworkbook, or they require something more.

Thanks
 
--

HTH

RP
(remove nothere from the email address if mailing direct)
 
In the Thisworkbook code module, select Workbook from the top left dropdown.
Select BeforeClose from the right dropdown. Then add the code into that
skeleton event.

PS Get rid of yours, you have clearly done it wrongly.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
In the Thisworkbook code module, select Workbook from the top left dropdown.
Select BeforeClose from the right dropdown. Then add the code into that
skeleton event.

PS Get rid of yours, you have clearly done it wrongly.

--

HTH

RP
(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