Roger,
You need to se the .Left and .RowIndex of your new commandbar based on an
existing commandbar. See the code example below.
HTH,
Bernie
MS Excel MVP
Sub AddSecondCommandbarAfterFirst()
Dim myBar1 As CommandBar
Dim myBar2 As CommandBar
On Error Resume Next
Application.CommandBars("NewCBName").Delete
Set myBar1 = Application.CommandBars("OldCBName")
Set myBar2 = Application.CommandBars.Add("NewCBName")
With myBar2
Set myButton = myBar.Controls.Add(Type:=msoControlButton, ID:=23)
With myButton
.Caption = "This or that"
.Style = msoButtonIcon
.FaceId = 137
End With
.Position = msoBarTop
.Left = myBar1.Width
.RowIndex = myBar1.RowIndex
.Visible = True
.Enabled = True
End With
End Sub
"rogervand " wrote in message
...
I have been successful in creating a custom commandbar with the buttons
I need. I would like to place the custom commandbar on the end of the
built in commandbars at the top of my window. I can get it up there,
but it seems to want to live on a line all by itself. I've been using
the following command:
commandbars("custom").rowindex = 2
It puts my bar where I want it, but moves the builtins down a row. Any
advice out there?
Thanks,
Roger
---
Message posted from http://www.ExcelForum.com/