popup konusunda yardım

Katılım
6 Ağustos 2005
Mesajlar
75
Excel Vers. ve Dili
2007 ENG
Altın Üyelik Bitiş Tarihi
25.01.2019
arkadaşlar popup menü için aşagıdaki kodları yazdım. ama sürekli hata veriyor. sorunun kaynağını bulabilirmisiniz.

Option Explicit
Const MenuAdi As String = "TemporaryPopupMenu"

Sub PopupSil()
On Error Resume Next
CommandBars(MenuAdi).Delete
On Error GoTo 0
End Sub

Sub PopupYap()
Dim cb As CommandBar
PopupSil
Set cb = CommandsBar.Add(MenuAdi, msoBarPopup, False, True)
With cb
With .Controls.Add(Type:=msoControlButton)
.OnAction = "Makro1"
.FaceId = 71
.Caption = "Makro1"
End With

With .Controls.Add(Type:=msoControlButton)
.OnAction = "Makro2"
.FaceId = 72
.Caption = "Makro2"
End With

With .Controls.Add(Type:=msoControlButton)
.OnAction = "Makro3"
.FaceId = 73
.Caption = "Makro3"
End With

With .Controls.Add(Type:=msoControlButton)
.OnAction = "Makro4"
.FaceId = 74
.Caption = "Makro4"
End With
End Sub


Sub Makro1()
ActiveCell.Value = 1
End Sub

Sub Makro2()
ActiveCell.Value = 2
End Sub

Sub Makro3()
ActiveCell.Value = 3
End Sub

Sub Makro4()
ActiveCell.Value = 4
End Sub

Sub auto_close()
PopupSil
End Sub

Sub auto_open()
PopupYap
End Sub



Option Explicit
Const MenuAdi As String = "TemporaryPopupMenu"
Private Sub Worksheet_BeforeRightClick(ByVal Target As Excel.Range, Cancel As Boolean)
Cancel = True
Application.CommandBars(MenuAdi).ShowPopup

End Sub
 
Üst