LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 113
Default Command Bar position

Great - thanks a lot guys - looks good
Cheers
Matt

"Jim Cone" wrote in message
...
Matt,

Looks like there is an easier way, using msoBarRowLast...
'--------------------------
Sub TestBarModified()
Dim MyCommandBar As CommandBar

Set MyCommandBar = CommandBars.Add(Name:="MyBar", _
Position:=msoBarTop, Temporary:=True)

MyCommandBar.RowIndex = msoBarRowLast

MyCommandBar.Visible = True
Set MyCommandBar = Nothing
End Sub
'--------------------------

Regards,
Jim Cone


"Jim Cone" wrote in message
...
Matt,
You need to provide the "RowIndex"...
MyCommandBar.RowIndex = Application.CommandBars("Formatting").RowIndex +

1
If the Formatting toolbar is visible, the above code places MyCommandBar
just below the formatting toolbar.
No, you cannot determine the rowindex by just counting the visible

toolbars.
Also, you still need msoBarTop.
OR, go thru the CommandBar collection and find the largest rowindex...
Sub TestBar()
Dim MyCommandBar As CommandBar
Dim lngBarIndex As Long
For Each MyCommandBar In Application.CommandBars
If MyCommandBar.Visible Then lngBarIndex = _
WorksheetFunction.Max(lngBarIndex, MyCommandBar.RowIndex)
Next
Set MyCommandBar = CommandBars.Add(Name:="MyBar", _
Position:=msoBarTop, Temporary:=True)
MyCommandBar.RowIndex = lngBarIndex + 1
MyCommandBar.Visible = True
Set MyCommandBar = Nothing
End Sub
Regards,
Jim Cone
San Francisco, USA




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
One command in one cell initiating another command in another cel. Chas52 Excel Worksheet Functions 3 November 7th 09 06:57 PM
command code ( GOTO command) in formula calan New Users to Excel 1 June 11th 09 09:44 AM
command button position Gerry Excel Discussion (Misc queries) 4 November 2nd 08 12:39 PM
Pivot Table Error Message - "Command Text not set for command obje Jeff Divian Excel Discussion (Misc queries) 0 November 7th 07 10:26 PM
Command Button Position Kenny Excel Discussion (Misc queries) 3 October 14th 07 09:19 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"