Standard Toolbar Association

xl_psychic

Active Member
Joined
Jan 4, 2004
Messages
359
Hi All,

I have created a custom commandbar which houses my own macros..

This command bar is created everytime Excel is opened.

For the time being I have kept the commandbar as a floating object.

Any ideas how can I fix it to be attached next to the Standard CommandBar or the Formatting CommandBar.

Help Appreciated...
 

Some videos you may like

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,069
Office Version
  1. 2016
Platform
  1. Windows
Hi,

This will add a Custom CommandBar called "Test" ALWAYS located next to the Standard XL toolbar.

Code:
Sub Test()

    Dim i As Byte
    With CommandBars.Add("Test")
         For i = 1 To 6
            .Controls.Add.FaceId = i
        Next i
        .Position = CommandBars("Standard").Position 
        .RowIndex = CommandBars("Standard").RowIndex
        .Visible = True
    End With

End Sub

Regards.
 

xl_psychic

Active Member
Joined
Jan 4, 2004
Messages
359
Jaafar:

Thanks for the piece of code... I have only one regret.. What do I need to change in the code for my commandbar to appear "after" the Standard Toolbar...

When I execute this code the custom toolbar appears before the Standard Toolbar... I tried playing with RowIndex and Position values but in vain...

Help Appreciated...
 

xl_psychic

Active Member
Joined
Jan 4, 2004
Messages
359
Jaafar:

I did some search on the board for commandbars properties and this piece of code helped me do just what I wanted...

Code:
Set cb = Application.CommandBars.Add(ThisCommandBarName, , False, True)
    
With cb
.Position = CommandBars("Standard").Position
.RowIndex = CommandBars("Standard").RowIndex
.Left = CommandBars("Standard").Left + CommandBars("Standard").Width
.Visible = True
End With

Thanks for the guidance...
 

Watch MrExcel Video

Forum statistics

Threads
1,118,799
Messages
5,574,385
Members
412,590
Latest member
Velly
Top