PDA

View Full Version : Calendar Control



tammytutone
06-15-2009, 11:12 AM
I am using Word 2007 and I have created a template with a custom userform. There is an area in my document where a day and date is needed and I would like to put a calendar on the userform for the user to select the date, but there is no control in the toolbox for a calendar. Is there another way to add a calendar to my userform and if so, how do I code it so that the date format shows as Monday, June 15, 2009 in the form? Thanks for any help and suggestions.

fumei
06-15-2009, 11:50 AM
: but there is no control in the toolbox for a calendar. "

To add Additional controls to the Toobox, right click the Toolbox and select Additional controls. There is a Calendar control.

However, I do not know if there are any issues with 2007. There very well may be, but I will not use 2007, so I will leave any possible issues to those who do use 2007.

The calendar is an OCX, and...shrug..who knows? I suggest trying to see if you can add a calendar Additional control. I would assume even with the weirdness of 2007 that if you can see it, you can use it.

fumei
06-15-2009, 11:54 AM
Oh, and: "how do I code it so that the date format shows as Monday, June 15, 2009 in the form?"

The OCX calendar shows as a calendar on the userform, so I do not really know what you mean by the above. Look up Format in Help if you need help on formatting the .Value (the selected date) of the calendar in any given format.

fumei
06-15-2009, 12:39 PM
Demo attached. Click "Demo Cal" on the top toolbar. You can mess around and pick any date you like. Various formats are indicated on the userform. When you are ready click the "Insert in doc" button. The selected date is inserted at a bookmark, and a +60 day date is also inserted at its own bookmark.

Mind you, this is for 2002/03 version. It may run under 2007, but I don't know...or care. It should though, that is if the Calendar OCX file is still legitimate for 2007. I am posting it in case it may help those who want a demonstrated calendar control for pre-2007.

tammytutone
06-15-2009, 12:55 PM
Thank you for all of your help and suggestions. It worked perfectly!

fumei
06-16-2009, 09:00 AM
Than can you please mark this thread as Solved? Thanks.