I have written the following code in personal.xls to add a pop up calendar
First to add the menu item.
___
Private Sub Workbook_Open()
Dim NewControl As CommandBarControl
Set NewControl = Application.CommandBars("Cell".Controls.Add
With NewControl
.Caption = "Insert Date"
.OnAction = "Module1.opencalendar1"
.BeginGroup = True
End With
End Sub
_____
Then to remove the item before closing.
___
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars("Cell".Controls("Insert Date".Delete
End Sub
__
My problem is the "Insert Date" menu items appears multiple times. It does not recognize this code
”Application.CommandBars("Cell".Controls("Insert Date".Delete”
If I use the immediate window and type
“Application.CommandBars("Cell".Controls("Insert Date".Delete”
The menu item is removed
How do I get excel to recognize the "delete code" before close without having to use the immediate window?
Mike
First to add the menu item.
___
Private Sub Workbook_Open()
Dim NewControl As CommandBarControl
Set NewControl = Application.CommandBars("Cell".Controls.Add
With NewControl
.Caption = "Insert Date"
.OnAction = "Module1.opencalendar1"
.BeginGroup = True
End With
End Sub
_____
Then to remove the item before closing.
___
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars("Cell".Controls("Insert Date".Delete
End Sub
__
My problem is the "Insert Date" menu items appears multiple times. It does not recognize this code
”Application.CommandBars("Cell".Controls("Insert Date".Delete”
If I use the immediate window and type
“Application.CommandBars("Cell".Controls("Insert Date".Delete”
The menu item is removed
How do I get excel to recognize the "delete code" before close without having to use the immediate window?
Mike