Thread: Toolbars
View Single Post
  #18   Report Post  
Posted to microsoft.public.excel.programming
TK TK is offline
external usenet poster
 
Posts: 177
Default Toolbars


Bob Phillips" wrote:

TK,

I disagree with Doug on this, keeping to this thread seems right to me.

Are you saying that when you click on the tab that won't trigger a workbook
event. What do you want to happen when you change sheets?


Nothing, just to change sheets

Can I also just check what works.

- does the workbook_open/beforeclose act correctly on the toolbars?


Not to sure what you mean. I'm not using those events.
I started by using the Workbook_Open but the
WorkBook_Activate recalled the function even when the
Wookbook was initially opened so it wasn't necessary.


- does the workbook_activate/deactivate work correctly on the toolbars?
- for all workbooks?


Perfect, and the toolbar buttons work (they call dummy events)


So what else do you need to happen?


Nothing, the only problem at this time is when the WorkBook
is activated either initially or another workbook is opened and
then closed and the activate event calls ShowTooBars if you click
on a different sheet it does nothing. If you enter data in a cell or
move the page (as in adjust it) the selector then works.

Other Notes:
The sheet selector works when I start Excel so it is not Excel.
This is the only procedure in the WorkBook Im testing in so
there should not be any conflicts.
I removed
€ś On Error Resume Next€ť
€śApplication.CommandBars("cbrCommandBar").Delete €ś
to try to fail the procedure but it didnt fail.
It has to be in the procedure but I cant seem to find
the problem.

Thanks
TK

--

HTH

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


"TK" wrote in message
...
Doug

Well you are right about the new threat except you
and Bob know what I'm doing and it would take a lot
of explaining to bring others up to speed. By the page
selector I meant as in using the mouse to pick either
sheet1 sheet2 sheet3. I guess I see now why you didn't
understand the question. Page is not the right term.
It was not my intension to abuse this thread, but
knowing what I was doing I was hoping one of you may
have experienced this and could share some ideas.

Thanks
TK

"Doug Glancy" wrote:

TK,

I don't know what you mean by "Page Selector." If it's an unrelated
question to your original post, you should probably just start a new

thread.

hth,

Doug

"TK" wrote in message
...
Thanks Bob/Doug

Bob
Actually, I'm familiar with some of your procedures having studied

them
from
some of your previous post. With the help of some of your examples,
Microsoft's
library examples and some specific help from Ron de Bruin I have all

the
procedures I just needed to learn from where and how to call them and

as
you
indicate
activate, deactivate is the event. Please read the question in my

reply
to
Doug.

Doug
Workbook_Acitivate, Workbook_Deactivate in the ThisWorkBook module

calls
the functions properly. Thanks for reminding me of the msgbox trick I

use
that all
the time it must have been late.

Now that all seems to be working I have another problem. After the

toolbar
is
loaded the page selector will not select another page until something

is
entered
in a cell and enter is pressed.

I have tried to force a calculation in code, F9 and Ctrl+Alt+F9

without
and
happiness.
Any advise on this one ?

Thanks
TK


"Bob Phillips" wrote:

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.