PC Review


Reply
Thread Tools Rate Thread

Custom toolbar, setting docked position

 
 
ker_01
Guest
Posts: n/a
 
      24th Jul 2008
I'm creating a custom toolbar, and for convenience, I plan to have it only
show up when my workbook is open (via an add-in) and only when my workbook
is active (will code that later).

To make sure it is always easy to find the toolbar, I want to check the
location of all visible toolbars at the top of the Excel window, and dock
this new custom toolbar on a new row below the lowest pre-existing docked
toolbar.

I've been playing with different characteristics of the visible toolbars,
but haven't found a consistent way to identify the lowest active toolbar and
create mine just below it. for example:

Sub testbarlocations()
For Each ctlCBarControl In Application.CommandBars
If ctlCBarControl.Visible = True Then
MsgBox ctlCBarControl.Name & " " & ctlCBarControl.RowIndex &
ctlCBarControl.position
End If
Next
End Sub


I get the following results:
rowindex position
Menubar 2 1
Standard 3 1
Formatting 20 1 <--high rowindex, but docked in the top
group of toolbars
VB 21 1<--high rowindex, but docked in the top
group of toolbars
Control tbx 21 1 <--same rowindex and position as VB, but
docked to the right of the VB toolbar
Drawing 1 3 <-- drawing is docked at the bottom of
the window
MyCustom 22 1 <-- manually docked below the VB/Control tbx
at top of screen

A few problems: This also shows toolbars at the bottom of the screen, so
I'll need to create a max value to pay attention to- if a toolbar returns a
row/position below halfway down the screen, then it isn't one I need to
worry about.

So these parameters don't mean what I'd intuitively think they mean; I did
see msoBarRowFirst but that moves the toolbar to the top of the toolbar
group, which isn't my desired outcome. Notably, when I did test that, then
moved the MyCustom back to the target position, it's rowindex changed to 23.

Does position 1 mean top of screen, 2 means something else (maybe side
docked, or floating) and 3 means bottom? If so, I can limit my evaluation to
the position=1 toolbars.

Can anyone shed some light on rowindex for me? Is there a different property
I should be looking at? Should I just set the rowindex of my new toolbar to
a value of one higher than any other position 1 toolbar?

Thanks!!
Keith


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Locking position of Custom Toolbar OssieMac Microsoft Access VBA Modules 3 21st Jan 2008 09:18 AM
Re: Custom Toolbar Docked amidst all other toolbars Jim Cone Microsoft Excel Programming 0 11th Dec 2006 09:01 PM
Custom Toolbar Position Zone Microsoft Excel Programming 0 31st May 2006 06:16 PM
Custom Toolbar position Michelle Microsoft Excel Programming 3 1st Sep 2004 08:25 PM
Custom Toolbar Position always on new row Aslan Microsoft Excel Misc 0 7th May 2004 10:30 AM


Features
 

Advertising
 

Newsgroups
 


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