Resetting Form Fields

R

Robin1979

Hi,
I have the following maco assigned to a check box in my form but it appears
as the macro lock and unlocks the form all the form fields are reset, even
though Ive got the No Reset option set to true it is still resetting them, is
there an easy way to over come this?

Thanks
Robin



Sub OnExitSite1a()
Dim bProtected As Boolean
Dim rText As Range
Dim oFld As FormFields
Dim sPassword As String
Set oFld = ActiveDocument.FormFields
Set rText = ActiveDocument.Bookmarks("CheckSiteResult1a").Range
sPassword = "" 'password if any to unprotect the form
'Unprotect the file
If ActiveDocument.ProtectionType <> wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect Password:=sPassword
End If
'Check whether CheckSite1a is checked
If oFld("CheckSite1a").CheckBox.Value = True Then
rText.Text = "WaddOrders please setup new site code"
Else
rText.Text = ""
End If
With ActiveDocument
.Bookmarks.Add "CheckSiteResult1a", rText
.Fields.Update
End With
'Reprotect the document.
Finished:
If bProtected = True Then
ActiveDocument.Protect _
Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=sPassword

End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top