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 / Menus and Toolbars / September 2004

Tip: Looking for answers? Try searching our database.

auto text date

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
G - 27 Sep 2004 22:09 GMT
We have some letters here that were created with the auto
text feature in use to provide the current date in the
body of the letter. Can this featured be set to show the
original creation date of the document or just show a
static date instead of updating each time the document is
opened. The problem is that these docs were created by
another office with the auto text feature activated to
update the date field. Because there are many letters we
don't want to have to open each one, delete the auto text
date and type in a different date by hand.

Thanks much!
Suzanne S. Barnhill - 27 Sep 2004 23:42 GMT
Press Alt+F9 to display field codes. In the field code for the date, change
DATE or TIME to CREATEDATE. Alt+F9 to toggle back and F9 to update.

Signature

Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

> We have some letters here that were created with the auto
> text feature in use to provide the current date in the
[quoted text clipped - 8 lines]
>
> Thanks much!
Graham Mayor - 28 Sep 2004 08:57 GMT
There is no real alternative to editing the letters individually, however,
the following macro will convert any date field fields (fields that update
each time you open the document) to createdate fields. Add it to a toolbar
button to fix the date in the current document with a single click. At a
pinch you could rename the macro "Autoopen" and the macro would run
automatically on opening each document, but I prefer the manual approach. It
should also be possible to incorporate the technique used to batch process a
folder full of files, and there is code on my site and on the MVP site which
shows the techniques involved  and what to do with listings like this, but
I'll leave you to sort that out :)

Sub FixDates()
' Replace Date fields with CreateDate fields
' Macro created 28/09/2004 by Graham Mayor

Dim FindText  As String
Dim oStory As Range
Dim oField As Field

FindText = "^d DATE"
Application.ScreenUpdating = False
On Error GoTo oops

Documents.Add
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, _
   PreserveFormatting:=False
Selection.TypeText Text:="CREATEDATE \@ ""dd/MM/yyyy"""
'Change the date mask above to suit local preferences
Selection.WholeStory
Selection.MoveLeft Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.Copy
ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
ActiveWindow.View.ShowFieldCodes = True

'Replace found text with the clipboard contents.
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
 .Text = FindText
 .Replacement.Text = "^c"
 .Forward = True
 .Wrap = wdFindContinue
 .Format = False
 .MatchCase = False
 .MatchWholeWord = False
 .MatchWildcards = False
 .MatchSoundsLike = False
 .MatchAllWordForms = False
End With
Selection.Find.Execute replace:=wdReplaceAll

ActiveWindow.View.ShowFieldCodes = False
 For Each oStory In ActiveDocument.StoryRanges
   For Each oField In oStory.Fields
     oField.Update
   Next oField
 Next oStory
Application.ScreenUpdating = True
End
oops:
End Sub

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor -  Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

> We have some letters here that were created with the auto
> text feature in use to provide the current date in the
[quoted text clipped - 8 lines]
>
> Thanks much!
 
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.