如何在Excel CommandBar上垂直排列按钮?

时间:2019-01-11 15:29:30

标签: excel vba commandbar

我的代码在自定义命令栏上创建了2个按钮。它工作正常,但是2个按钮并排放置,我希望它们垂直堆叠。我怎样才能解决这个问题 ?

Sub Crea_Menu()
    With Application.CommandBars.Add(Name:="GL", Temporary:=True)
        .Visible = True
        .Width = .Height / 2    'tried this but has no effect !
        With .Controls.Add(Type:=msoControlButton, Temporary:=True)
            .OnAction = "GenerateRpt"
            .Caption = "GL report"
            .Style = msoButtonCaption
        End With
        With .Controls.Add(Type:=msoControlButton, Temporary:=True)
            .OnAction = "Version"
            .Caption = "Version " & Format(Sheet2.Range("A2").Value2, "0.00")
            .Style = msoButtonCaption
        End With
    End With
End Sub

0 个答案:

没有答案