Essas macros do Aprenda Microsoft Excel VBA(Visual Basic Application) -- SaberExcel --, inserem uma barra de ferramenta personalizada com combobox agregado à barra, essa macro que poderá resolver seu problema ela insere essa barra com o combobox na barra, e chama algumas macros através dos botões inseridos
Option Explicit
Sub Barra_Eves_Personalizada()
On Error Resume Next CommandBars("XL-Eves®").Delete On Error GoTo 0
With CommandBars.Add(Name:="XL-Eves®") With .Controls.Add(Type:=msoControlButton) .Caption = "XL-Eves®" .OnAction = "msg" .FaceId = 343 .TooltipText = "Aprender VBA (XL-Eves®)" End With
With .Controls.Add(Type:=msoControlPopup) .Caption = "Menu" .TooltipText = "Inserir ordem crescente e decrescente" With .Controls.Add(Type:=msoControlButton) .Caption = "Ordem Crescente" .FaceId = 210 .OnAction = "crescente" End With
With .Controls.Add(Type:=msoControlButton) .Caption = "Ordem Decrescente" .FaceId = 211 .OnAction = "decrescente" End With
With .Controls.Add(Type:=msoControlButton) .Caption = "Deletar_barra" .FaceId = 507 .OnAction = "deletar_barra" End With
End With
With .Controls.Add(msoControlDropdown) .AddItem "AA" .AddItem "BB" .AddItem "CC" .OnAction = "msg" .TooltipText = "testes com barras" End With
.Position = msoBarTop .Visible = True End With End Sub
Sub msg() MsgBox "Aprenda excel vba, Esforce-se! ", vbInformation, "XL-Eves®" End Sub
Sub crescente() MsgBox ("Ordem Crescente Excel VBA Estudos®"), vbExclamation, "XL-Eves®" End Sub
Sub decrescente() MsgBox ("Ordem Decrescente Excel VBA Estudos®"), vbExclamation, "XL-Eves®" End Sub
Sub deletar_barra() CommandBars("XL-Eves®").Delete End Sub
'inserir no módulo workbook
Option Explicit
Private Sub Workbook_Open() Call Barra_Eves_Personalizada End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean) On Error Resume Next Application.CommandBars("XL-Eves®").Delete End Sub
Aprenda Microsoft Excel VBA(Visual Basic Application) -- SaberExcel --

|