Thread: Toolbars
View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Toolbars

TK,

Typically, I have a set of menus that I only want associated with one
particular workbook. For this I create application events and delete/hide
the menu if that workbook is deactivated, load/show it when activated.

Is this any good for you, if so I will give you the code, just tell me your
toolbar name, and where it sits (Off of Tools, or a toolbar).

--

HTH

RP
(remove nothere from the email address if mailing direct)


"TK" wrote in message
...
Thanks

Bob / Jim / Doug

In clarification the procedures (functions) work ok and the
Set cbrCommandBar =... Temporary:=True
so if the workbook (wb1)is opened then closed all is good.

However, if another workbook is opened before wb1 is closed
the toolbar is still visible in that workbook.
So I need to toggle the functions when wb1 is the active
workbook and when it is not.

I hope helps you to help me.

Thanks
TK


"Doug Glancy" wrote:

TK,

I'm not sure I'm understanding exactly, but I think you would be better

off
actually deleting the toolbar, rather than setting visible to false.
Typically the create module also starts by deleting the toolbar:

on error resume next 'if there's no toolbar you won't get error
mybar.delete
on error goto 0

This way you don't get the error that comes from creating a toolbar that
already exists.

hth,

Doug Glancy

"TK" wrote in message
...
Hi

I have a function in a module that creates a toolbar with VBA.
"ShowToolBar"
Also a function that deletes (set visual to False).
"HideToolBar"
Now for example:
Wb1 has the modual and then wb2 is opened but wb1 is still open
but inactive, I would like to delete the toolbar when wb2 opens.
When wb2 becomes inactive or whenever wb1 becomes active
again I would like to restore the toolbar.

I have called the function from Worksheet_Activate
WorkSheetDeactivate; Workbook_Open / Close all without
much happiness.

Any help would be greatly appreciated.