|
From: fenixdood on 30 Jun 2008 10:12 Hi, I have been asked to modify one of our Word Macros so that the date stays static. Currently we are using { DATE \@ "MMMM d, yyyy" \*MERGEFORMAT } This is fine but when ever the document is opened again the date changes to the current date and not the one that was supposed to be for the Originating Date.. Could someone perhaps point me to the right place to get this answered... PS not a Macro or VBA expert by any means but do have scripting under my belt... Cheers an TIA Ron
From: Graham Mayor on 30 Jun 2008 10:50 This has little to do with macros. The obvious solution would be to change the DATE field in the document template to a CREATEDATE field. CREATEDATE always shows the date it was created in the template and the dates the documents created from that template will show they dates they were created. The \*MERGEFORMAT switch is superfluous here and can be removed from the field. Thus { CREATEDATE \@ "MMMM d, yyyy" } If you are inserting the date from a macro then fields need not come into it at all eg Sub InsertUSFormatDate() With Selection .InsertDateTime DateTimeFormat:="MMMM" & Chr(160) & _ "d," & Chr(160) & "yyyy", InsertAsField:=False End With End Sub will insert the current date as text at the cursor. -- <>>< ><<> ><<> <>>< ><<> <>>< <>><<> Graham Mayor - Word MVP My web site www.gmayor.com Word MVP web site http://word.mvps.org <>>< ><<> ><<> <>>< ><<> <>>< <>><<> fenixdood wrote: > Hi, > > I have been asked to modify one of our Word Macros so that the date > stays static. Currently we are using > { DATE \@ "MMMM d, yyyy" \*MERGEFORMAT } > This is fine but when ever the document is opened again the date > changes to the current date and not the one that was supposed to be > for the Originating Date.. > > Could someone perhaps point me to the right place to get this > answered... > > PS not a Macro or VBA expert by any means but do have scripting under > my belt... > > Cheers an TIA > > Ron
From: Jay Freedman on 30 Jun 2008 10:55 fenixdood wrote: > Hi, > > I have been asked to modify one of our Word Macros so that the date > stays static. Currently we are using > { DATE \@ "MMMM d, yyyy" \*MERGEFORMAT } > This is fine but when ever the document is opened again the date > changes to the current date and not the one that was supposed to be > for the Originating Date.. > > Could someone perhaps point me to the right place to get this > answered... > > PS not a Macro or VBA expert by any means but do have scripting under > my belt... > > Cheers an TIA > > Ron The usual answer is to use a CREATEDATE field instead of a DATE field. That will always display the date the document was created, either by making a new document based on the template or by using Save As from an existing document. If the creation date isn't what you want, you can instead either lock or unlink the DATE field when it's showing the correct date. Locking the field (in code, if the variable myField points to the DATE field in question, execute myField.Locked = True) prevents the field from updating until you unlock it. Unlinking the field (in code, execute myField.Unlink) replaces the field with the plain text of its current value, which of course will never update. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
From: Fenixdood on 2 Jul 2008 12:13 Thanks for the info.. caviat is...I used the CreateDate but it inputs the date the template was created. I am in need of a user who creates a new document from template. then the date is hard coded immediatley and will not change.. not too sure how the VB code should be on this one.. can you help out..?. Cheers Ron "Jay Freedman" wrote: > fenixdood wrote: > > Hi, > > > > I have been asked to modify one of our Word Macros so that the date > > stays static. Currently we are using > > { DATE \@ "MMMM d, yyyy" \*MERGEFORMAT } > > This is fine but when ever the document is opened again the date > > changes to the current date and not the one that was supposed to be > > for the Originating Date.. > > > > Could someone perhaps point me to the right place to get this > > answered... > > > > PS not a Macro or VBA expert by any means but do have scripting under > > my belt... > > > > Cheers an TIA > > > > Ron > > The usual answer is to use a CREATEDATE field instead of a DATE field. That > will always display the date the document was created, either by making a > new document based on the template or by using Save As from an existing > document. > > If the creation date isn't what you want, you can instead either lock or > unlink the DATE field when it's showing the correct date. Locking the field > (in code, if the variable myField points to the DATE field in question, > execute myField.Locked = True) prevents the field from updating until you > unlock it. Unlinking the field (in code, execute myField.Unlink) replaces > the field with the plain text of its current value, which of course will > never update. > > -- > Regards, > Jay Freedman > Microsoft Word MVP FAQ: http://word.mvps.org > Email cannot be acknowledged; please post all follow-ups to the newsgroup so > all may benefit. > > >
From: Jay Freedman on 2 Jul 2008 21:57 In the template itself, the CreateDate field will show the template's date of creation. When you base a new document on the template, it _will_ show the document's date of creation, not the template's. Of course it would be possible to write an AutoNew macro to insert the current date as plain text, but that would be reinventing the wheel because the CreateDate field does exactly what you're asking for. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. On Wed, 2 Jul 2008 09:13:01 -0700, Fenixdood <Fenixdood(a)discussions.microsoft.com> wrote: >Thanks for the info.. > >caviat is...I used the CreateDate but it inputs the date the template was >created. I am in need of a user who creates a new document from template. >then the date is hard coded immediatley and will not change.. > >not too sure how the VB code should be on this one.. can you help out..?. > >Cheers >Ron > >"Jay Freedman" wrote: > >> fenixdood wrote: >> > Hi, >> > >> > I have been asked to modify one of our Word Macros so that the date >> > stays static. Currently we are using >> > { DATE \@ "MMMM d, yyyy" \*MERGEFORMAT } >> > This is fine but when ever the document is opened again the date >> > changes to the current date and not the one that was supposed to be >> > for the Originating Date.. >> > >> > Could someone perhaps point me to the right place to get this >> > answered... >> > >> > PS not a Macro or VBA expert by any means but do have scripting under >> > my belt... >> > >> > Cheers an TIA >> > >> > Ron >> >> The usual answer is to use a CREATEDATE field instead of a DATE field. That >> will always display the date the document was created, either by making a >> new document based on the template or by using Save As from an existing >> document. >> >> If the creation date isn't what you want, you can instead either lock or >> unlink the DATE field when it's showing the correct date. Locking the field >> (in code, if the variable myField points to the DATE field in question, >> execute myField.Locked = True) prevents the field from updating until you >> unlock it. Unlinking the field (in code, execute myField.Unlink) replaces >> the field with the plain text of its current value, which of course will >> never update. >> >> -- >> Regards, >> Jay Freedman >> Microsoft Word MVP FAQ: http://word.mvps.org >> Email cannot be acknowledged; please post all follow-ups to the newsgroup so >> all may benefit. >> >> >>
|
Next
|
Last
Pages: 1 2 Prev: Compiling a template ('.dot') into a '.wll' add-in Next: Content controls |