|
|
| Next: Word 2003 Tables blink, flash, and jiggle and low.. |
| Author |
Message |
Linda Fiske External

Since: Jul 20, 2007 Posts: 1
|
Posted: Fri Jul 20, 2007 8:20 pm Post subject: populating form fields from a single date Archived from groups: microsoft>public>word>vba>userforms (more info?) |
|
|
Hi:
This is an example of the kind of template I am trying to create:
July 23, 2007 to July 27, 2007
MONDAY - 23
TUESDAY - 24
WEDNESDAY - 25
THURSDAY - 26
FRIDAY - 27
DR. ASSIGNMENT
I would like the user to be able to input the beginning date (for example
"July 23, 2007" ) and have the rest of the fields automatically populate,
i.e., have the "to July 27, 2007" field populate by adding 5 days to the
beginning date; have Monday's date be extracted from the beginning date; and
Tuesday's date be extracted from the beginning date by adding 1, Wednesday
by adding 2, etc.
Is this possible??? Any guidance on how would be greatly appreciated.
Gratefully,
Linda |
|
| Back to top |
|
 |
Doug Robbins - Word MVP External

Since: Jul 14, 2006 Posts: 2538
|
Posted: Sun Jul 22, 2007 5:37 pm Post subject: Re: populating form fields from a single date [Login to view extended thread Info.] Archived from groups: per prev. post (more info?) |
|
|
For the following macro, which you would set to run on exit from the
formfield into which the user enters the starting date, I have given
meaningful bookmark names to each of the formfields
Dim sdate As Date
Dim sday As Integer
With ActiveDocument
If IsDate(.FormFields("Start").Result) Then
sdate = .FormFields("Start").Result
sday = Format(sdate, "d")
.FormFields("Finish").Result = Format(DateAdd("d", 4, sdate), "MMMM
dd, yyyy")
.FormFields("Monday").Result = "Monday " & Format(sday, "0#")
.FormFields("Tuesday").Result = "Tuesday " & Format(sday + 1, "0#")
.FormFields("Wednesday").Result = "Wednesday " & Format(sday + 2,
"0#")
.FormFields("Thursday").Result = "Thursday " & Format(sday + 3,
"0#")
.FormFields("Friday").Result = "Friday " & Format(sday + 4, "0#")
Else
MsgBox "You did not input a valid date."
End If
End With
--
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
"Linda Fiske" <lmfis DeleteThis @extremezone.com> wrote in message
news:eo7egY0yHHA.5584@TK2MSFTNGP02.phx.gbl...
> Hi:
> This is an example of the kind of template I am trying to create:
>
> July 23, 2007 to July 27, 2007
>
> MONDAY - 23
> TUESDAY - 24
> WEDNESDAY - 25
> THURSDAY - 26
> FRIDAY - 27
> DR. ASSIGNMENT
>
>
>
> I would like the user to be able to input the beginning date (for example
> "July 23, 2007" ) and have the rest of the fields automatically populate,
> i.e., have the "to July 27, 2007" field populate by adding 5 days to the
> beginning date; have Monday's date be extracted from the beginning date;
> and
> Tuesday's date be extracted from the beginning date by adding 1, Wednesday
> by adding 2, etc.
>
> Is this possible??? Any guidance on how would be greatly appreciated.
>
> Gratefully,
> Linda
>
> |
|
| Back to top |
|
 |
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
| |
|
|