From: Robin1979 on 19 Mar 2010 12:31 Hi, I have the following Macro which I thought should not reset form fields but each time its used and it relocks the form the formfields are reset, please could someone be kind enough to point me in the right direction of where it is going wrong? 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 'Reprotect the document. Finished: If bProtected = True Then ActiveDocument.Protect _ Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=sPassword End If End Sub
|
Pages: 1 Prev: Resetting Form Fields Next: W2003: find cursor location in table coordinates (table/row/column |