sbuffington
New Member
- Joined
- Jan 14, 2019
- Messages
- 8
I created the popup calendar from Martin Green's site, saved it in a personal project like it said, and I keep getting the "Insert Date" adding to the context menuwhen you right click in a cell tofirethe popup calendar. The only thing that I can imagine is that the Workbook_BeforeClose code is not working. I've tried including the Application.EnableEvent=true in immediate window and that doesnt seem to work either.
Code:
Private Sub Workbook_Open()
Dim NewControl As CommandBarControl
Application.OnKey "+^{C}", "Module1.OpenCalendar"
Set NewControl = Application.CommandBars("Cell").Controls.Add
With NewControl
.Caption = "Insert Date"
.OnAction = "Module1.OpenCalendar"
.BeginGroup = True
End With
Application.EnableEvents = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars("Cell").Controls("Insert Date").Delete
End Sub