S
SteveB
Hello, I have approximately 1000 documents created in Word 6 which include a
date field in the header. This should show the create date of the document.
In Word 2003 this shows as the current date.
The field format is as follows:-
{TIME \@ "dd MMMM yyyy"}
And I have worked out that this needs to be updated to:-
{"CREATEDATE \* "dd MMMM yyyy" \* MERGEFORMAT}
If I record a macro as below (which works on the document as I am recording
it) then it fails to execute when called in other documents.
I strongly suspect that the quotes are the issue or it might possibly be
related to the fact the field is in a header, but have no idea how to resolve
this.
Any help would be much appreciated.
Sub FANDRDATEFIELD()
'
' FANDRDATEFIELD Macro
' Macro recorded 03/08/2008 by Simun
'
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
..Text = "TIME \@ ""dd MMMM yyyy"""
..Replacement.Text = "CREATEDATE \* ""dd MMMM yyyy"" \* MERGEFORMAT"
..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 = Not ActiveWindow.View.ShowFieldCodes
Selection.Fields.Update
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToNext, Count:=1, Name:=""
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
..Text = "TIME \@ ""dd MMMM yyyy"""
..Replacement.Text = "CREATEDATE \* ""dd MMMM yyyy"" \* MERGEFORMAT"
..Forward = True
..Wrap = wdFindContinue
..Format = False
..MatchCase = False
..MatchWholeWord = False
..MatchWildcards = False
..MatchSoundsLike = False
..MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub
date field in the header. This should show the create date of the document.
In Word 2003 this shows as the current date.
The field format is as follows:-
{TIME \@ "dd MMMM yyyy"}
And I have worked out that this needs to be updated to:-
{"CREATEDATE \* "dd MMMM yyyy" \* MERGEFORMAT}
If I record a macro as below (which works on the document as I am recording
it) then it fails to execute when called in other documents.
I strongly suspect that the quotes are the issue or it might possibly be
related to the fact the field is in a header, but have no idea how to resolve
this.
Any help would be much appreciated.
Sub FANDRDATEFIELD()
'
' FANDRDATEFIELD Macro
' Macro recorded 03/08/2008 by Simun
'
ActiveWindow.View.ShowFieldCodes = Not ActiveWindow.View.ShowFieldCodes
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
..Text = "TIME \@ ""dd MMMM yyyy"""
..Replacement.Text = "CREATEDATE \* ""dd MMMM yyyy"" \* MERGEFORMAT"
..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 = Not ActiveWindow.View.ShowFieldCodes
Selection.Fields.Update
Selection.GoTo What:=wdGoToHeading, Which:=wdGoToNext, Count:=1, Name:=""
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
..Text = "TIME \@ ""dd MMMM yyyy"""
..Replacement.Text = "CREATEDATE \* ""dd MMMM yyyy"" \* MERGEFORMAT"
..Forward = True
..Wrap = wdFindContinue
..Format = False
..MatchCase = False
..MatchWholeWord = False
..MatchWildcards = False
..MatchSoundsLike = False
..MatchAllWordForms = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End Sub