Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Remove autoupdate text field from documents (2003)

    Hi,

    I am having trouble with the autoupdate of the insert date property, letters have been created using the automatically update date selected and now every time the letter is opened the date is updated to the current date.

    Is there a way to scan the document for all instantances of this property and even switch off the automatic update or delete from the document and replace with the current date

    Many thanks
    Regards
    Gerbil (AKA Kevin)

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Remove autoupdate text field from documents (2003)

    The following macro will replace all DATE fields in the body of the document and in all headers and footers with their current value (the current date):
    <code>
    Sub KillDateFields()
    Dim sec As Section
    Dim rng As Range
    Dim hdr As HeaderFooter
    Dim fld As Field

    For Each fld In ActiveDocument.Fields
    If fld.Type = wdFieldDate Then
    fld.Unlink
    End If
    Next fld

    For Each sec In ActiveDocument.Sections
    For Each hdr In sec.Headers
    If hdr.Exists Then
    For Each fld In hdr.Range.Fields
    If fld.Type = wdFieldDate Then
    fld.Unlink
    End If
    Next fld
    End If
    Next hdr

    For Each hdr In sec.Footers
    If hdr.Exists Then
    For Each fld In hdr.Range.Fields
    If fld.Type = wdFieldDate Then
    fld.Unlink
    End If
    Next fld
    End If
    Next hdr
    Next sec
    End Sub</code>

  3. #3
    3 Star Lounger
    Join Date
    Jul 2008
    Location
    Suffolk, United Kingdom
    Posts
    308
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Remove autoupdate text field from documents (2003)

    Hans, thank you very much
    Regards
    Gerbil (AKA Kevin)

  4. #4
    Super Moderator
    Join Date
    May 2002
    Location
    Canberra, Australian Capital Territory, Australia
    Posts
    5,054
    Thanks
    2
    Thanked 417 Times in 346 Posts

    Re: Remove autoupdate text field from documents (2003)

    Hi Kevin,

    Another way to achieve much the same result is to press Alt-F9 to expose the document's field coding, then use Find/Replace to replace all the 'DATE' strings with 'CREATEDATE'. Then toggle the field code display off again via Alt-F9. Having done that, you don't need to convert the fields to plain text. The only thing to watch for - which might also be beneficial in some contexts - is that saving such a file via File|Save As will re-set the CREATEDATE to the current date.
    Cheers,

    Paul Edstein
    [MS MVP - Word]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •