Notifications
Clear all

Chamar um Form no Menu

3 Posts
2 Usuários
0 Reactions
1,104 Visualizações
(@fernandox)
Posts: 68
Trusted Member
Topic starter
 

Ola Pessoal, tenho baixado este exemplo de menu suspenso e estou tentando fazer com que possa chamar o meu FormCadastroClientes, quem puder orientar-me no sentido de saber como chamar o Formulario de Clientes neste Menu, fico grato a todos que postarem no auxilio, abraco

Sub Abrir_planilha()

Application.CommandBars("Cell").Reset
  
        Dim cbc As CommandBarControl
  
        'Oculta todos os comandos do botão direito
        For Each cbc In Application.CommandBars("cell").Controls
                cbc.Visible = False
        Next cbc
        
  
            With Application.CommandBars("Cell").Controls.Add(Temporary:=True)
                .FaceId = 217
                .Caption = "Abrir Planilha"
                .OnAction = "Chamar_Cliente"
            End With
            
                     
   
       Application.CommandBars("Cell").ShowPopup
       
       Application.CommandBars("Cell").Reset
               For Each cbc In Application.CommandBars("cell").Controls
                cbc.Visible = True
        Next cbc
    Call Workbooks.Open(Filename:=link)
End Sub
Sub Chamar_Cliente()
    link = FormCadastroCliente
End Sub
 
Postado : 25/04/2018 10:59 am
(@klarc28)
Posts: 971
Prominent Member
 
Option Explicit

Sub BOTAODIREIRO()


Dim VARR As Variant
Dim I As Integer
Dim OMENU As CommandBar
Dim OITEM As CommandBarControl

Set OMENU = CommandBars.Add("", msoBarPopup, , True)
VARR = Array("FORM1", "FORM2")

For I = 0 To UBound(VARR)
Set OITEM = OMENU.Controls.Add
OITEM.Caption = VARR(I)
OITEM.OnAction = VARR(I)

Next I
OMENU.ShowPopup

End Sub

Sub FORM1()

UserForm1.Show
End Sub

Sub FORM2()
UserForm2.Show
End Sub

Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Call BOTAODIREIRO
Cancel = True
End Sub

https://youtu.be/uFcwKd7C6qs

 
Postado : 25/04/2018 11:13 am
(@fernandox)
Posts: 68
Trusted Member
Topic starter
 

Ola klarc28, fico grato pelas dicas e orientacoes, acabei encontrando a solucao neste video. Obrg, abraco

https://www.youtube.com/watch?v=uiM51AzUOyI

 
Postado : 26/04/2018 12:55 pm