Well, I love this macro and I'm going to keep it for future reference but I
don't think I can search for a date field and replace with a createdate
field, the find and replace dialog didn't allow for that.
Thank you for your help.
> > Hi,
> >
[quoted text clipped - 4 lines]
> Try ythis page:
> http://word.mvps.org/faqs/macrosvba/BatchFR.htm
Jean-Guy Marcil - 05 Mar 2008 20:49 GMT
> Well, I love this macro and I'm going to keep it for future reference but I
> don't think I can search for a date field and replace with a createdate
> field, the find and replace dialog didn't allow for that.
You can add code to toggle the display of field codes in the document, and
then you can use the find/replace to replace field code with other field
code...
Sammy - 05 Mar 2008 21:58 GMT
That's so smart! Thanks a lot.
> > Well, I love this macro and I'm going to keep it for future reference but I
> > don't think I can search for a date field and replace with a createdate
[quoted text clipped - 3 lines]
> then you can use the find/replace to replace field code with other field
> code...
Graham Mayor - 06 Mar 2008 10:50 GMT
The batch macro you cannot find may have been
Sub BatchFixDates()
Dim myFile As String
Dim PathToUse As String
Dim myDoc As Document
Dim iFld As Integer
Dim fDialog As FileDialog
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
.Title = "Select Folder containing the documents to be modifed and click
OK"
.AllowMultiSelect = False
.InitialView = msoFileDialogViewList
If .Show <> -1 Then
MsgBox "Cancelled By User"
Exit Sub
End If
PathToUse = fDialog.SelectedItems.Item(1)
If Right(PathToUse, 1) <> "\" Then PathToUse = PathToUse + "\"
End With
If Documents.Count > 0 Then
Documents.Close Savechanges:=wdPromptToSaveChanges
End If
myFile = Dir$(PathToUse & "*.do?")
While myFile <> ""
Set myDoc = Documents.Open(PathToUse & myFile)
ActiveWindow.View.ShowFieldCodes = True
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
If .Type = wdFieldDate Then
.Code.Text = Replace(.Code.Text, "DATE", "CREATEDATE")
.Update
End If
End With
Next iFld
ActiveWindow.View.ShowFieldCodes = False
myDoc.Close Savechanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub
which I have posted a couple of times recently.

Signature
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
My web site www.gmayor.com
Word MVP web site http://word.mvps.org
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> That's so smart! Thanks a lot.
>
[quoted text clipped - 6 lines]
>> document, and then you can use the find/replace to replace field
>> code with other field code...
fumei - 05 Mar 2008 20:52 GMT
Dim oField As Field
For Each oField In ActiveDocument.Fields
If oField.Type = 31 Then
oField.Select
Selection.Fields(1).Delete
ActiveDocument.Fields.Add Range:=Selection.Range, Type:=21
End If
Next
will change DATE fields (Type 31) to CREATEDATE fields (Type 21)
>Well, I love this macro and I'm going to keep it for future reference but I
>don't think I can search for a date field and replace with a createdate
[quoted text clipped - 7 lines]
>> Try ythis page:
>> http://word.mvps.org/faqs/macrosvba/BatchFR.htm
Sammy - 05 Mar 2008 21:58 GMT
Thank you for your time
> Dim oField As Field
> For Each oField In ActiveDocument.Fields
[quoted text clipped - 18 lines]
> >> Try ythis page:
> >> http://word.mvps.org/faqs/macrosvba/BatchFR.htm