How control where the CommandBar will be placed?

  • Thread starter Thread starter Gunnar Johansson
  • Start date Start date
G

Gunnar Johansson

Hi,

I have a CommandBar with buttons that always is placed below the ordinary
menues/bars. If I relocate it to a better place, it always come back below
again. Can I control where it should be located? On second commandbar row to
the left?

Kind Regards
 
By trial and error (don't know if it will work exactly the same on all
systems):

With CommandBars("MyCommandBar")
.Top = 50
.Left = 0
End With
 
Gunnar,

This places a new command bar to the left of the Formatting toolbar.
If you want the next row up, change "Formatting" to "Standard".
'----------------------------
Dim MyCommandBar As Office.CommandBar
Set MyCommandBar = CommandBars.Add(Name:="MyBar", _
Position:=msoBarTop, Temporary:=True)
'Add some buttons here
MyCommandBar.RowIndex = _
Application.CommandBars("Formatting").RowIndex
MyCommandBar.Visible = True
Set MyCommandBar = Nothing
'--------------------------

Jim Cone
San Francisco, USA
 
Hi,

Still I want the commandbar to be located together with the ordinary ones. I
wasn't clear on this. I guess your code will make it a floationg bar, right
or wrong?

Kind Regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top