Compile error since upgrading to 2003

seacrest

Active Member
Joined
Aug 15, 2002
Messages
301
I am experiencing a strange problem with a date picker macro that i use on many workbooks since upgrading to 2003
I get a Compile error: Variable not defined


However I can create a new workbook with the same code and it works fine
Here is the code

Option Explicit

' ===================================================
' Code by Martin Green eMail martin@fontstuff.com
' Visit my Office Tips web site at www.fontstuff.com
' ===================================================

Private Sub cmdClose_Click()
' Close the UserForm
Unload Me
End Sub

Private Sub UserForm_Initialize()
' Check if active cell contains a date. If 'yes' show
' same date on calendar. If 'no' show today's date.
If IsDate(ActiveCell.Value) Then
Calendar1.Value = DateValue(ActiveCell.Value)
Else
Calendar1.Value = Date
End If
End Sub

Private Sub Calendar1_Click()
' Transfer date selected on calendar to active cell
' and close UserForm.
ActiveCell.Value = Calendar1.Value
Unload Me
End Sub
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Either the calendar control is not installed on your system (it is part of Office professional, I think it "belongs" to Access), or you have to add a reference to it in your VBA project.
 
Upvote 0
My new workbook has a reference Microsoft Calendar Control 11.0
but the old workbook doesn't.
Any ideas on how to add too the old


Thanks,
 
Upvote 0
I think your easiest solution is to delete the calendar control from the userform and add it again.
 
Upvote 0
Can you attach the workbook (removing any sensitive information, but still showing the problem)
 
Upvote 0

Forum statistics

Threads
1,224,606
Messages
6,179,865
Members
452,948
Latest member
UsmanAli786

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top