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...
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,666
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...
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,167,835
Messages
5,855,907
Members
431,772
Latest member
dannyboi1

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top