0

Hi all I hope you are well. I am trying to add a calendar control to a user form in Excel, but I do not see a calendar option in the user form toolbox. I have found a resource on line calender excel but when i take the code supplied in this link and put it into my own sheet i get the following pop up Error message

The code that I am trying to make work is:

Private Sub UserForm_Initialize()

Set Calendar1 = New cCalendar
Calendar1.Add_Calendar_into_Frame Me.Frame1

End Sub

I am using the frame option in the user form tool box. I am trying to control the format of how the date is entered into an excel sheet. if there is a simpler way I would love to know. Again any help would be greatly appreciated.

Gareth
  • 5,140
  • 5
  • 42
  • 73
Philip Connell
  • 651
  • 5
  • 25
  • 53
  • Did you add the code to a class module (not a normal module) and rename the class `cCalendar`? – Rory Jul 14 '16 at 11:41
  • Possible duplicate of http://stackoverflow.com/questions/13409653/how-to-add-date-picker-to-vba-userform – Robin Mackenzie Jul 14 '16 at 12:38
  • Hi Rory. I am afraid I don't know if i added it to a class of a normal module. I just went to the tool box under the user form selected frame and copied and pasted the code. Might it be easier to just put some formatting on the cells. the problem I am having is that people put the date in different formats. (ie) 14.07.206 14/07/2016 14.Jul.16 etc iif i can stop them at the cell on the sheet that might negate the need for a user form and make this task much easier. any thoughts – Philip Connell Jul 14 '16 at 13:16
  • @Robin Agreed, kind of, but, the question there is for 32 bits Excel and this a custom calendar. Philip is this for 64 bits? Note: in 64 bits office, the calendar form doesn't exists and you need to create a custom one with a form. If you are in 32 bits, why not to use the example provided -in the link for the question provided-? – Sgdva Jul 14 '16 at 13:44
  • So i have been following the instructions with the link above. I now have managed to get the calendar icon into the tool box of the User form but when i go to run the form to see the date function in action i get the following pop up. 'Run time error '-2147220995 (800401fd)': Automation error Object is not connected to the server. Is there a was around this? – Philip Connell Jul 14 '16 at 14:00

0 Answers0