Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.newusers
|
|||
|
|||
Displaying consecutive Dates On A Form
MSWord 2000, XP Professional
Hi, I have a document that is basically a form with a section for each day of the week. Currently, every week I have to change all seven dates before printing the document. What I would like is to be able to enter the first date and have all the rest calculated automatically. I have got as far as a single Form Field to enter the first date. I'm now trying to insert Formula fields for the rest. The FirstDate (Form Field) is defined as type 'Date', is set to 'Calculate on Exit' and has a name in the BookMark field setting ('MyDate') The first Formula Field looks somthing like {=MyDate+1 \@"dd/MM/yy}. I then set document protection to 'Forms' When I enter a date in the FormField, the formula field changes to TODAYS date, regardless of the FormField date. Anyone help me out here? Note: It has to be a entered date, and not based on the current date, as it can vary when this form is required, and the start date is not usually todays date, or a fixed deviation from it. Cheers, ChrisM. |
#2
Posted to microsoft.public.word.newusers
|
|||
|
|||
Displaying consecutive Dates On A Form
Hi Chris,
You could do this sort of thing with formula fields, and the topic 'Calculate a Stepped Date Range' in my Date Calc 'tutorial', at: http://www.wopr.com/cgi-bin/w3t/show...?Number=249902 shows how one might go about this. If you look it up, you'll find the field computations are far more complex than one might expect - because Word wasn't designed with this sort of thing in mind. For your purposes, a macro driven by the 'run macro on exit' property might do the job with a lot less bother. For starters, the new dates could be calculated by the vba DateAdd function, which does in one line of code what umpteen lines of field coding are otherwise required for. For example, supposing your formfield names are 'Text1' to 'Text7', you could use something like: Sub CalcDates() Dim iDate As Date Dim i As Integer With ActiveDocument If IsDate(.FormFields("Text1").Result) Then iDate = CDate(.FormFields("Text1").Result) For i = 2 To 7 iDate = CDate(iDate + 1) .FormFields("Text" & i).Result = iDate Next Else MsgBox ("Enter a valid date.") End If End With End Sub Cheers -- macropod [MVP - Microsoft Word] "ChrisM" wrote in message ... MSWord 2000, XP Professional Hi, I have a document that is basically a form with a section for each day of the week. Currently, every week I have to change all seven dates before printing the document. What I would like is to be able to enter the first date and have all the rest calculated automatically. I have got as far as a single Form Field to enter the first date. I'm now trying to insert Formula fields for the rest. The FirstDate (Form Field) is defined as type 'Date', is set to 'Calculate on Exit' and has a name in the BookMark field setting ('MyDate') The first Formula Field looks somthing like {=MyDate+1 \@"dd/MM/yy}. I then set document protection to 'Forms' When I enter a date in the FormField, the formula field changes to TODAYS date, regardless of the FormField date. Anyone help me out here? Note: It has to be a entered date, and not based on the current date, as it can vary when this form is required, and the start date is not usually todays date, or a fixed deviation from it. Cheers, ChrisM. |
#3
Posted to microsoft.public.word.newusers
|
|||
|
|||
Displaying consecutive Dates On A Form
If only it was that simple - see
http://www.gmayor.com/insert_a_date_...than_today.htm -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ChrisM wrote: MSWord 2000, XP Professional Hi, I have a document that is basically a form with a section for each day of the week. Currently, every week I have to change all seven dates before printing the document. What I would like is to be able to enter the first date and have all the rest calculated automatically. I have got as far as a single Form Field to enter the first date. I'm now trying to insert Formula fields for the rest. The FirstDate (Form Field) is defined as type 'Date', is set to 'Calculate on Exit' and has a name in the BookMark field setting ('MyDate') The first Formula Field looks somthing like {=MyDate+1 \@"dd/MM/yy}. I then set document protection to 'Forms' When I enter a date in the FormField, the formula field changes to TODAYS date, regardless of the FormField date. Anyone help me out here? Note: It has to be a entered date, and not based on the current date, as it can vary when this form is required, and the start date is not usually todays date, or a fixed deviation from it. Cheers, ChrisM. |
#4
Posted to microsoft.public.word.newusers
|
|||
|
|||
Displaying consecutive Dates On A Form
Thanks for your replays.
How crazy is that calculation...??! Will go to plan B(as suggested) and write a little VBA macro. .... or maybe just stick to filling the dates in by hand!! :-( Thanks again, ChrisM |
#5
Posted to microsoft.public.word.newusers
|
|||
|
|||
Displaying consecutive Dates On A Form
Just copy the field code from macropod's document and change the final
switch and the delay. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ChrisM wrote: Thanks for your replays. How crazy is that calculation...??! Will go to plan B(as suggested) and write a little VBA macro. ... or maybe just stick to filling the dates in by hand!! :-( Thanks again, ChrisM |
#6
Posted to microsoft.public.word.newusers
|
|||
|
|||
Displaying consecutive Dates On A Form
Or maybe even use the code in supplied in my previous post in this thread
.... Cheers -- macropod [MVP - Microsoft Word] "Graham Mayor" wrote in message ... Just copy the field code from macropod's document and change the final switch and the delay. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ChrisM wrote: Thanks for your replays. How crazy is that calculation...??! Will go to plan B(as suggested) and write a little VBA macro. ... or maybe just stick to filling the dates in by hand!! :-( Thanks again, ChrisM |
#7
Posted to microsoft.public.word.newusers
|
|||
|
|||
Displaying consecutive Dates On A Form
"Graham Mayor" wrote in message ... Just copy the field code from macropod's document and change the final switch and the delay. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ChrisM wrote: Thanks for your replays. How crazy is that calculation...??! Will go to plan B(as suggested) and write a little VBA macro. ... or maybe just stick to filling the dates in by hand!! :-( Thanks again, ChrisM "macropod" wrote in message ... Or maybe even use the code in supplied in my previous post in this thread ... My specific example was slightly more complicated than how I explained it. I was just after a basic technique. However, I have written a little macro now (based on your code, thanks) and all is good... Only problem now is that the guy who will be using it has 'high security' set on his PC, and it won't run Word macros. Have to try and convince him that he won't become infested with viruses if he enables them. Cheers, ChrisM. |
#8
Posted to microsoft.public.word.newusers
|
|||
|
|||
Displaying consecutive Dates On A Form
Hi Chris,
In that case, you still have the field code version as a last resort - macro settings don't apply to fields! Cheers -- macropod [MVP - Microsoft Word] "ChrisM" wrote in message ... "Graham Mayor" wrote in message ... Just copy the field code from macropod's document and change the final switch and the delay. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ChrisM wrote: Thanks for your replays. How crazy is that calculation...??! Will go to plan B(as suggested) and write a little VBA macro. ... or maybe just stick to filling the dates in by hand!! :-( Thanks again, ChrisM "macropod" wrote in message ... Or maybe even use the code in supplied in my previous post in this thread ... My specific example was slightly more complicated than how I explained it. I was just after a basic technique. However, I have written a little macro now (based on your code, thanks) and all is good... Only problem now is that the guy who will be using it has 'high security' set on his PC, and it won't run Word macros. Have to try and convince him that he won't become infested with viruses if he enables them. Cheers, ChrisM. |
#9
Posted to microsoft.public.word.newusers
|
|||
|
|||
Displaying consecutive Dates On A Form
Create the form as a template and have him save it in his templates folder.
Then it will be considered as trusted and will not given an macro warning when he creates a new document from it by selecting New from the File menu and selecting the template. -- 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 "ChrisM" wrote in message ... "Graham Mayor" wrote in message ... Just copy the field code from macropod's document and change the final switch and the delay. -- Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org ChrisM wrote: Thanks for your replays. How crazy is that calculation...??! Will go to plan B(as suggested) and write a little VBA macro. ... or maybe just stick to filling the dates in by hand!! :-( Thanks again, ChrisM "macropod" wrote in message ... Or maybe even use the code in supplied in my previous post in this thread ... My specific example was slightly more complicated than how I explained it. I was just after a basic technique. However, I have written a little macro now (based on your code, thanks) and all is good... Only problem now is that the guy who will be using it has 'high security' set on his PC, and it won't run Word macros. Have to try and convince him that he won't become infested with viruses if he enables them. Cheers, ChrisM. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
displaying the user form data | Mailmerge | |||
Merge Excel data into specific form areas in a Word Doc | Microsoft Word Help | |||
how to keep a locked form from displaying markups on opening. | Microsoft Word Help | |||
Word doc/protected form and formatting dates | Microsoft Word Help | |||
Enter data in 1 text form field & have multiple locations fill | Microsoft Word Help |