You are on page 1of 3

MEnu:

Sub crear_menu()

Dim menu As CommandBar

Dim submenu As CommandBarPopup

Dim boton1 As CommandBarButton

Dim boton2 As CommandBarButton

Set menu = Application.CommandBars.Add(Name:="MiBarra", Position:=msoBarPopup,


MenuBar:=False, Temporary:=True)

With menu

Set submenu = .Controls.Add(Type:=msoControlPopup)

With submenu

.Caption = "SubMenú"

Set boton1 = .Controls.Add(Type:=msoControlButton)

With boton1

.Caption = "Saludo"

.FaceId = 71

.OnAction = "Macro1"

End With

Set boton2 = .Controls.Add(Type:=msoControlButton)

With boton2

.Caption = "Revisar Formulario"

.FaceId = 72

.OnAction = "Macro2"

End With

End With

End With

End Sub
Sub Macro1()

MsgBox "Hola Mundo, mi nombre es Eileen"

End Sub

Sub llamar_Menu()

On Error Resume Next

Application.CommandBars("MiBarra").Delete

crear_menu

Application.CommandBars("MiBarra").ShowPopup

End Sub

Sub Macro2()

MsgBox "Si quieres ir al formulario debes ir a la otra hoja"

End Sub
Private Sub guardar_Click()

Dim nombre As String

Dim apellido As String

Dim cedula As String

nombre = nameC.Text

apellido = apeC.Text

cedula = celC.Text

If (nombre <> "" And apellido <> "" And cedula <> "") Then

Sheets("Data").Activate

Range("A2").EntireRow.Insert

Range("A2").Value = nombre

Range("B2").Value = apellido

Range("C2").Value = cedula

Sheets("Data").Activate

Else

MsgBox "Los campos no deben estar vacíos."

End If

End Sub

You might also like