ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   removing a toolbar with code (https://www.excelbanter.com/excel-programming/323781-removing-toolbar-code.html)

Papa Jonah

removing a toolbar with code
 
I have been trying to get a file to remove a toolbar when the file is closed.
Currently the toolbar is generated with code upon opening the file. This
works good.
But, I cannot figure out how to get it to delete when I close the file.
This is what I have at this point:

Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, _
Cancel As Boolean)
Application.CommandBars("my toolbar").Delete
Cancel = False

End Sub

TIA

Tom Ogilvy

removing a toolbar with code
 
What you show is an application level event. Assuming that is what you
want,
You would need to instantiate application level events. See Chip Pearson's
site

http://www.cpearson.com/excel/appevent.com

--
Regards,
Tom Ogilvy

"Papa Jonah" wrote in message
...
I have been trying to get a file to remove a toolbar when the file is

closed.
Currently the toolbar is generated with code upon opening the file. This
works good.
But, I cannot figure out how to get it to delete when I close the file.
This is what I have at this point:

Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, _
Cancel As Boolean)
Application.CommandBars("my toolbar").Delete
Cancel = False

End Sub

TIA




Ken Wright

removing a toolbar with code
 
Hi Tom - better make that .htm instead of .com :-)

http://www.cpearson.com/excel/appevent.htm

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------
<snip



Ken Wright

removing a toolbar with code
 
Hi Tom - better make that .htm instead of .com :-)

http://www.cpearson.com/excel/appevent.htm

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------



Papa Jonah

removing a toolbar with code
 
A workbook level event would be fine with me, but I couldn't get it to work
so I settled for application level.

"Tom Ogilvy" wrote:

What you show is an application level event. Assuming that is what you
want,
You would need to instantiate application level events. See Chip Pearson's
site

http://www.cpearson.com/excel/appevent.com

--
Regards,
Tom Ogilvy

"Papa Jonah" wrote in message
...
I have been trying to get a file to remove a toolbar when the file is

closed.
Currently the toolbar is generated with code upon opening the file. This
works good.
But, I cannot figure out how to get it to delete when I close the file.
This is what I have at this point:

Private Sub App_WorkbookBeforeClose(ByVal Wb As Workbook, _
Cancel As Boolean)
Application.CommandBars("my toolbar").Delete
Cancel = False

End Sub

TIA






All times are GMT +1. The time now is 12:31 AM.

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