commandbar.msoBarTop, next to each other??

DaLiMan

Active Member
Joined
Jun 1, 2004
Messages
295
Hi There,

I have a custom commandbar wich I like to have positioned next to the already excisting 'standard' commandbars of Excel.
Now whatever position I give it, it will NOT be placed next to it. The only place it appears is below the excisting commandbars.

Is there a solution for this?

The current code is like:
(Still in testing fase....)

Code:
Sub PositionCommandBar()
    With CommandBars("DLmenu")
        .Position = msoBarTop
        .Left = 850 
        .Top = 5 
    End With
End Sub

Sub Create_DLMenu()
    Dim MyBar As CommandBar
    Dim MyPopup As CommandBarPopup
    Dim MyButton As CommandBarButton
     
    ' Delete the commandbar if it exists already
    On Error Resume Next
    Application.CommandBars("DLmenu").Delete
    
    Set MyBar = CommandBars.Add(Name:="DLmenu", _
    Position:=msoBarFloating, temporary:=True)
     
    With MyBar
        '.Top = 175
        '.Left = 850
         
        Set MyPopup = .Controls.Add(Type:=msoControlPopup)
        With MyPopup
            .Caption = "DL_menu"
            .BeginGroup = True
            Set MyButton = .Controls.Add(Type:=msoControlButton)
            With MyButton
                .Caption = "yellow" 'this the text
                .Style = msoButtonCaption
                 ''' msoButtonAutomatic, msoButtonIcon, msoButtonCaption, or msoButtonIconandCaption
                .BeginGroup = True
                .OnAction = "yellow" 'macro to be run,change to EmailSLA
            End With
             'this code to add another button
            Set MyButton = .Controls.Add(Type:=msoControlButton)
            With MyButton
                .Caption = "chicken"
                .Style = msoButtonCaption
                .BeginGroup = False
                .OnAction = "chicken"
            End With
        End With
        
        Set ComBarContrl = MyBar.Controls.Add(Type:=msoControlButton)
        With ComBarContrl
             'the facId line will let you choose an icon
             ' If you choose to use the faceId then the caption is not displayed
            .BeginGroup = True
            .FaceId = 1000
            .Caption = "Icon Button"
            .TooltipText = "Run Macro2"
             'the onaction line tells the button to run a certain macro
            .OnAction = "Macro2"
        End With
        Set ComBarContrl = MyBar.Controls.Add(Type:=msoControlButton)
        With ComBarContrl
             'the facId line will let you choose an icon
             ' If you choose to use the faceId then the caption is not displayed
            .BeginGroup = False
            .FaceId = 1000
            .Caption = "Icon Button"
            .TooltipText = "Run Macro2"
             'the onaction line tells the button to run a certain macro
            .OnAction = "Macro2"
        End With

         
        '.Width = 150
        .Visible = True
    End With
     
Call PositionCommandBar
End Sub
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

Forum statistics

Threads
1,224,616
Messages
6,179,909
Members
452,949
Latest member
beartooth91

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
Back
Top