Reply
 
Thread Tools Display Modes
  #1   Report Post  
Bruce Hudson via OfficeKB.com
 
Posts: n/a
Default Embedded Calendar

I am making a protected word form, which requires several date entries. I
would like to have a small drop down calendar, to select a date and fill in
the field. I see them on websights, quicken etc...

--
Message posted via http://www.officekb.com
  #2   Report Post  
Doug Robbins
 
Posts: n/a
Default

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.
--
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
"Bruce Hudson via OfficeKB.com" wrote in message
...
I am making a protected word form, which requires several date entries. I
would like to have a small drop down calendar, to select a date and fill
in
the field. I see them on websights, quicken etc...

--
Message posted via http://www.officekb.com



  #3   Report Post  
Bruce Hudson via OfficeKB.com
 
Posts: n/a
Default

Doug,

I'm close!!! Two problems though...

1. As I tab through several fields in the document, the calendar pops up
on each one, but when I make a selection the new date goes into the first
date field in the document. The remaining fields remain blank.

2. After selecting a date for a field, I can't click on the filled in
field and select a new date.

Thanks




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.
I am making a protected word form, which requires several date entries. I
would like to have a small drop down calendar, to select a date and fill
in
the field. I see them on websights, quicken etc...


Reply

--
Message posted via http://www.officekb.com
  #4   Report Post  
Doug Robbins
 
Posts: n/a
Default

For 1., it sounds like you must have the Macro to run on entry to each of
those fields set to the one that calls the userform.

For 2., it will be necessary to tab into the formfield to get the macro that
calls the userform to fire.

--
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
"Bruce Hudson via OfficeKB.com" wrote in message
...
Doug,

I'm close!!! Two problems though...

1. As I tab through several fields in the document, the calendar pops up
on each one, but when I make a selection the new date goes into the first
date field in the document. The remaining fields remain blank.

2. After selecting a date for a field, I can't click on the filled in
field and select a new date.

Thanks




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.
I am making a protected word form, which requires several date entries. I
would like to have a small drop down calendar, to select a date and fill
in
the field. I see them on websights, quicken etc...


Reply

--
Message posted via http://www.officekb.com



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedded Calendar Bruce Hudson via OfficeKB.com New Users 1 February 8th 05 11:27 AM
Word Calendar... Silas New Users 1 January 29th 05 07:00 AM
How do I hyperlink from Word to an embedded Excel spreadsheet's ce ROBE7234 Microsoft Word Help 5 December 15th 04 09:47 PM
Microsoft Word Calendar Brian Microsoft Word Help 1 December 11th 04 10:58 PM
How do I change embedded objects to what I actually typed? saidclan Microsoft Word Help 2 December 10th 04 01:53 PM


All times are GMT +1. The time now is 08:55 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"