Hello All,
I created a pop-up calendar using the Microsoft MonthView Control 6.0 and a command button to close the calendar and it works completely fine. Below code for your reference:
Code in the Command Button:
Private Sub cmdClose_Click()
Unload Me
End Sub
Code in the MonthView:
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
On Error Resume Next
ActiveCell.Value = DateClicked
Unload Me
End Sub
Code in the Workbook:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnKey "+^{C}"
Application.CommandBars("Cell").Controls("Insert Date").Delete
End Sub
Private Sub Workbook_Open()
On Error Resume Next
Dim NewControl As CommandBarControl
Application.OnKey "+^{C}", "Module1.OpenCalendar"
Application.CommandBars("Cell").Controls("Insert Date").Delete
Set NewControl = Application.CommandBars("Cell").Controls.Add
With NewControl
.Caption = "Insert Date"
.OnAction = "Module1.OpenCalendar"
.BeginGroup = True
End With
End Sub
Code in the Module:
Sub OpenCalendar()
frmCalendar.Show
EndSub
However, now even after deleting the code and the workbook itself, I can still see the "Insert Calendar" upon right click and unsure how this can be completely removed.
Is there any way this can be removed?
Thanks in advance of your assistance.
Regards,
Sachin
I created a pop-up calendar using the Microsoft MonthView Control 6.0 and a command button to close the calendar and it works completely fine. Below code for your reference:
Code in the Command Button:
Private Sub cmdClose_Click()
Unload Me
End Sub
Code in the MonthView:
Private Sub MonthView1_DateClick(ByVal DateClicked As Date)
On Error Resume Next
ActiveCell.Value = DateClicked
Unload Me
End Sub
Code in the Workbook:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.OnKey "+^{C}"
Application.CommandBars("Cell").Controls("Insert Date").Delete
End Sub
Private Sub Workbook_Open()
On Error Resume Next
Dim NewControl As CommandBarControl
Application.OnKey "+^{C}", "Module1.OpenCalendar"
Application.CommandBars("Cell").Controls("Insert Date").Delete
Set NewControl = Application.CommandBars("Cell").Controls.Add
With NewControl
.Caption = "Insert Date"
.OnAction = "Module1.OpenCalendar"
.BeginGroup = True
End With
End Sub
Code in the Module:
Sub OpenCalendar()
frmCalendar.Show
EndSub
However, now even after deleting the code and the workbook itself, I can still see the "Insert Calendar" upon right click and unsure how this can be completely removed.
Is there any way this can be removed?
Thanks in advance of your assistance.
Regards,
Sachin