Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2006

Tip: Looking for answers? Try searching our database.

Calendar Control Filling Formfield

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bill Foley - 18 Nov 2006 13:36 GMT
Hey Gang,

Stepping outside my comfort zone for a minute and need some help:

Word 2003

I have a protected form with fields from the Forms Toolbar.  One of my
fields is a date field that I am trying to populate from a calendar control
(keeping it as simple for our Church to use as possible).  I have a macro
that is run "On Entry" that opens the UserForm with the calendar control on
it.  I have a "Cancel" button that unloads the form if they don't need it.

What I am trying to do is run a macro on the "Double-Click" event that
populates the "SelectDate" formfield on my form with the selected date and
closes the userform.  I have the form set to open with the current date.  I
just can't seem to figure out how to declare the variable holding the date,
double-click the desired date to fill that variable, and have that variable
fill the formfield, and close the form.  For that matter, I don't even know
if this can be done this way.

Any ideas (assistance)?

TIA!

Signature

Bill Foley
Microsoft PowerPoint MVP
Microsoft Office Specialist Master Instructor
www.pttinc.com

Doug Robbins - Word MVP - 18 Nov 2006 16:20 GMT
Use the following code:

Private Sub Calendar1_DblClick()
ActiveDocument.FormFields("SelectDate").Result = Calendar1.Value
Me.Hide
End Sub

You may want to use the Format() function on the Calendar1.Value to get the
date into the format that you want

e.g.    Format(Calendar1.Value, "d MMMM yyyy") will give you the date in the
format 18 November 2006

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hey Gang,
>
[quoted text clipped - 20 lines]
>
> TIA!
Bill Foley - 18 Nov 2006 16:48 GMT
Thanks, Doug.  It works fine if I keep it as a *.doc, but when I save it as
a *.dot the calendar does not pop up when the field is entered.  I assume it
is because it is looking for "ActiveDocument" and the file is not saved yet?
Any way around it?  Would it be ActiveWindow or something else?  Sorry for
the brain damage, haven't done much coding in Word in quite some time.

Signature

Bill Foley
Microsoft PowerPoint MVP
Microsoft Office Specialist Master Instructor
www.pttinc.com

> Use the following code:
>
[quoted text clipped - 33 lines]
>>
>> TIA!
Doug Robbins - Word MVP - 18 Nov 2006 20:21 GMT
You would need to make sure that the macro that calls the userform is in the
template.  It is nothing to do with the document not yet being saved.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Thanks, Doug.  It works fine if I keep it as a *.doc, but when I save it
> as a *.dot the calendar does not pop up when the field is entered.  I
[quoted text clipped - 40 lines]
>>>
>>> TIA!
Bill Foley - 19 Nov 2006 03:17 GMT
Well, that is what is strange.  I originally had created this as a document
(.doc).  Once I had everything the way I wanted it, I changed the extension
to a .dot.  Everything is there in the VBE window.  I'm baffled!  Of course,
it doesn't take much!

Signature

Bill Foley
Microsoft PowerPoint MVP
Microsoft Office Specialist Master Instructor
www.pttinc.com

> You would need to make sure that the macro that calls the userform is in
> the template.  It is nothing to do with the document not yet being saved.
[quoted text clipped - 43 lines]
>>>>
>>>> TIA!
Doug Robbins - Word MVP - 19 Nov 2006 09:43 GMT
Changing the extension to .dot will not turn it into a template.  You would
need to change the file type in the File>Save As dialog.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Well, that is what is strange.  I originally had created this as a
> document (.doc).  Once I had everything the way I wanted it, I changed the
[quoted text clipped - 48 lines]
>>>>>
>>>>> TIA!
Bill Foley - 19 Nov 2006 22:54 GMT
L.I.B.!  I've been so used to changing PPT to PPS, I figured changing DOC to
DOT would work as well.  Matter of fact, in "Details" View it says it was a
template.  I did it the other way and it works fine.  Guess I better go back
to school!  HA!

Signature

Bill Foley
Microsoft PowerPoint MVP
Microsoft Office Specialist Master Instructor
www.pttinc.com

> Changing the extension to .dot will not turn it into a template.  You
> would need to change the file type in the File>Save As dialog.
[quoted text clipped - 53 lines]
>>>>>>
>>>>>> TIA!
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.