0

Getting a Compile error: method or data member not found when trying to initialize a calendar box from a user form. The error is at Me.Calendar.Value = Date

I believe it worked on 32 bit but we switched to 64 bit. I tried googling and a post said use Monthview but I couldn't get it to work. Any ideas how to get this to work? Is it a reference issue?

Private Sub btnCancel_Click()
' Close form on Cancel
    Unload Me
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
' Close form on exit (x-button)
    If CloseMode = 0 Then Unload Me
End Sub

Private Sub UserForm_Initialize()
' Start form on today's date
    Me.Calendar.Value = Date
    datePickerValue = 0
End Sub

Private Sub Calendar_DateClick(ByVal DateClicked As Date)
    ' Set variable to date selected on calendar
    datePickerValue = DateClicked
    
    ' Close calendar after date selected
    Me.Hide
    Unload Me
End Sub
tim
  • 73
  • 1
  • 3
  • 11
  • My guess would be that your VBProject has a reference to a library that is 32-bit only ... in the VBE, look in Tools > References and you will likely see a broken reference possibly to MSCOMCT2.OCX or MSCAL.OCX ... these libraries had a couple of calendar-like controls that are not available in 64-bit. I believe your only options are to roll your own VBA calendar, or Google for a replacement (a possibility is https://erlandsendata.no/?t=vbatips&c=recent&p=3780 though note I have not tested this) – JohnM Aug 30 '22 at 14:19
  • A helpful replacement via VBA should be [How can I create a calendar input in VBA Excel](https://stackoverflow.com/questions/54650417/how-can-i-create-a-calendar-input-in-vba-excel) – T.M. Aug 30 '22 at 19:38

0 Answers0