View Single Post
 
Old 06-24-2015, 12:18 AM
Maskot Maskot is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Jun 2015
Posts: 3
Maskot is on a distinguished road
Default Updating/Locking FormFields

Hi,
I need a help with WORD FormFields. I have a document with many formfields and I need to update all fields without two of them. One formfield shows amount in words so the field with this amount earlier cant be updated.
Could you please help? Macro below with problem on red. I need a part that will update each formfield separately.


Sub sbProtectSheet1()
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
ActiveDocument.Unprotect Password:=""
ActiveDocument.FormFields("qqq").Result = "XZX"
ActiveDocument.FormFields("wng").Result = "3000"
Dim dFormField As FormField
For Each dFormField In ActiveDocument.FormFields()
If dFormField.Name <> "wng" Then
dFormField.Update
End If
Next
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
ActiveDocument.Unprotect Password:=""
End Sub
Reply With Quote