ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Toolbar lives on (https://www.excelbanter.com/excel-programming/288101-toolbar-lives.html)

SS[_3_]

Toolbar lives on
 
Well I have now created a lovely little toolbar. My
problem, when I close the document, the toolbar still
stays open. Plus when I try to reopen the file, it yells
at me for having the toolbar there since it is trying to
create it.

I am sure it is a simple little line of code, I just can't
seem to get it.

Thanks

Sharon

Ron de Bruin

Toolbar lives on
 
In the macro/event that create the toolbar use this code to delete the
toolbar if it exist first before you create it

On Error Resume Next
Application.CommandBars("MyToolBar").Delete
On Error GoTo 0

Run the same code in the event or macro that you run when you cose the workbook


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"SS" wrote in message ...
Well I have now created a lovely little toolbar. My
problem, when I close the document, the toolbar still
stays open. Plus when I try to reopen the file, it yells
at me for having the toolbar there since it is trying to
create it.

I am sure it is a simple little line of code, I just can't
seem to get it.

Thanks

Sharon




Jim Rech

Toolbar lives on
 
Before creating a commandbar it's a good idea to delete it:

Sub DeleteMyBar()
On Error Resume Next
Commandbars("MyBar").Delete
End Sub
--
Jim Rech
Excel MVP



SS[_3_]

Toolbar lives on
 
You guys are all just the best!

Thanks




-----Original Message-----
In the macro/event that create the toolbar use this code

to delete the
toolbar if it exist first before you create it

On Error Resume Next
Application.CommandBars("MyToolBar").Delete
On Error GoTo 0

Run the same code in the event or macro that you run when

you cose the workbook


--
Regards Ron de Bruin
(Win XP Pro SP-1 XL2000-2003)
www.rondebruin.nl



"SS" wrote in

message ...
Well I have now created a lovely little toolbar. My
problem, when I close the document, the toolbar still
stays open. Plus when I try to reopen the file, it

yells
at me for having the toolbar there since it is trying to
create it.

I am sure it is a simple little line of code, I just

can't
seem to get it.

Thanks

Sharon



.



All times are GMT +1. The time now is 07:59 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com