Error in Calendar tool - Compile Error

S

Steen

Hi

I have been changing some thing in excel so that my calendar tool dosent
work any more. I get the error message: "Compile Error - User-defined type
not defined" when I open an emthy sheet and the debugger stops at:

PERSONAL.XLS:

Private Sub Workbook_Open()

=> Dim NewControl As CommandBarControl

' Assign shortcut to display calendar on SHIFT+CTRL+C
Application.OnKey "+^{C}", "Module1.OpenCalendar"
' Add item to shortcut menu on open
On Error Resume Next
Application.CommandBars("Cell").Controls("Insert Date").Delete
On Error GoTo 0
Set NewControl = Application.CommandBars("Cell").Controls.Add
With NewControl
.Caption = "Insert Date"
.OnAction = "Module1.OpenCalendar"
.BeginGroup = True
End With
End Sub

Any suggestions of how to make this work again would be much appriciated?
 
J

Jim Rech

That compile error is consistence with having removed the reference to the
Microsoft Office object. Tools, References in the VBE.

--
Jim
| Hi
|
| I have been changing some thing in excel so that my calendar tool dosent
| work any more. I get the error message: "Compile Error - User-defined type
| not defined" when I open an emthy sheet and the debugger stops at:
|
| PERSONAL.XLS:
|
| Private Sub Workbook_Open()
|
| => Dim NewControl As CommandBarControl
|
| ' Assign shortcut to display calendar on SHIFT+CTRL+C
| Application.OnKey "+^{C}", "Module1.OpenCalendar"
| ' Add item to shortcut menu on open
| On Error Resume Next
| Application.CommandBars("Cell").Controls("Insert Date").Delete
| On Error GoTo 0
| Set NewControl = Application.CommandBars("Cell").Controls.Add
| With NewControl
| .Caption = "Insert Date"
| .OnAction = "Module1.OpenCalendar"
| .BeginGroup = True
| End With
| End Sub
|
| Any suggestions of how to make this work again would be much appriciated?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top