I assume that you have locked the forms? The fields don't work as intended
unless the form is locked.
In order to remove the form fields, you first need to unlock the form.
The following macro will then remove any form fields in the document.
Sub RemoveFFields()
ActiveDocument.ActiveWindow.View.ShowFieldCodes = True
With Selection
.HomeKey Unit:=wdStory
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "^d FORMTEXT"
.Replacement.Text = " "
.Forward = True
.Wrap = wdFindContinue
.Format = True
.MatchCase = False
.MatchWholeWord = False
.MatchAllWordForms = False
.MatchSoundsLike = False
.MatchWildcards = False
.Execute replace:=wdReplaceAll
End With
End With
ActiveDocument.ActiveWindow.View.ShowFieldCodes = False
End Sub
If you are changing the use of the document, you might want to consider
changing the form fields to macrobutton place markers.
eg
Sub ChangeFFields()
ActiveWindow.View.ShowFieldCodes = True
Dim oRng As Range
Dim iFld As Integer
For iFld = ActiveDocument.Fields.Count To 1 Step -1
With ActiveDocument.Fields(iFld)
.Code.Text = replace(.Code.Text, "FORMTEXT", "MACROBUTTON
NoMacro Enter Text")
.Update
End With
Next iFld
With ActiveWindow.View
.FieldShading = wdFieldShadingAlways
.ShowFieldCodes = False
End With
CommandBars("Forms").Visible = False
End Sub
You may even be able to ypdate all the forms at once if you put them in a
folder and run the following macro, though this would only work if none of
the forms were password protected or if they were not all protected with the
same password which you would enter between the quotes at:
ActiveDocument.Unprotect Password:=""
I recommend you test with copies of the documents!!!
Sub BatchFixFields()
Dim myFile As String
Dim PathToUse As String
Dim MyDoc As Document
Dim iFld As Integer
Dim bProtected As Boolean
'Unprotect the file
If ActiveDocument.ProtectionType <> wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=""
End If
With Dialogs(wdDialogCopyFile)
If .Display <> 0 Then
PathToUse = .Directory
Else
MsgBox "Cancelled by User"
Exit Sub
End If
End With
If Documents.Count > 0 Then
Documents.Close SaveChanges:=wdPromptToSaveChanges
End If
If Left(PathToUse, 1) = Chr(34) Then
PathToUse = Mid(PathToUse, 2, Len(PathToUse) - 2)
End If
myFile = Dir$(PathToUse & "*.doc")
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)
.Code.Text = replace(.Code.Text, "FORMTEXT", "MACROBUTTON
NoMacro Enter Text")
.Update
End With
Next iFld
With ActiveWindow.View
.FieldShading = wdFieldShadingAlways
.ShowFieldCodes = False
End With
CommandBars("Forms").Visible = False
MyDoc.Close SaveChanges:=wdSaveChanges
myFile = Dir$()
Wend
End Sub
See
http://www.gmayor.com/installing_macro.htm
--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>