How to add Date and Time Picker Control to Word form???

C

Craig

Hi folks,
I've tried everything I can think of and I still can't figure out how
to add the Date and Time Picker Control to my Word document! :-(

Sugestions???

Thanks,
Ed
 
D

Doug Robbins

Here's something I posted a while back for someone else that may assist you:

Quote

It's a bit more complex than you might imagine, but not really too
difficult. You will need to use a Userform in conjunction with the form
that you have in the protected document. For the basics, see the article
"How to create a Userform" at:
http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

Name the userform "Calendar" and instead of adding text boxes to it, add a
Calendar control. To get this, you will need to right click on the toolbox
in the Visual Basic Editor and select the Additional Controls item. In the
dialog that appears, click on the box next to the calendar control and it
will then be added to the toolbox. When it is there, you can then add it to
the user form. By default, it will be assigned the name of Calendar1. You
will also need a Command Button on the user form and after you add that,
select it and then right click on it and select the View Code item and then
add the following code to the Click event:

Private Sub CommandButton1_Click()

ActiveDocument.FormFields("TxtDate").Result = Format(Calendar1, "d MMMM
yyyy")
Calendar.hide

End Sub

Next, in the template from which your protected form is being created,
create a macro name showcalendar() containing the following code

Sub showcalendar()

Calendar.Show

End Sub

Finally, in the properties dialog for the formfield on your protected form,
change the name of the bookmark assigned to the formfield to TxtDate and
from the Run Macro on Entry pulldown, select the Showcalendar macro.

Now, if you got all of this correct, when you protect the form and tab into
the TxtDate formfield, the userform with the calendar will be displayed.
When you select a date on the calendar and then click on the command button,
the selected date will be inserted into the TxtDate formfield.

I warned you that there was a bit more to it than you might think. Post
back if you have any problems.

Unquote

--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 

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