K
Kay
Thanks to Graham for responding to my message previously. I tried your
suggestion Graham and I am still having some problems with the code. I am
not sure why, but now it not only does not update...it clears out the form
field data as well. So adding the new code seemed to negate the wd
protection code that maintains the filled in data. I am including the
code....if you can help.
Sub FormsSpellCheck()
' If document is protected, Unprotect it.
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="not2day"
End If
' Set the language for the document.
Selection.WholeStory
Selection.LanguageID = wdEnglishUS
' Perform Spelling/Grammar check.
If Options.CheckGrammarWithSpelling = True Then
ActiveDocument.CheckGrammar
Else
ActiveDocument.CheckSpelling
End If
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
' ReProtect the document.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If
End Sub
suggestion Graham and I am still having some problems with the code. I am
not sure why, but now it not only does not update...it clears out the form
field data as well. So adding the new code seemed to negate the wd
protection code that maintains the filled in data. I am including the
code....if you can help.
Sub FormsSpellCheck()
' If document is protected, Unprotect it.
If ActiveDocument.ProtectionType <> wdNoProtection Then
ActiveDocument.Unprotect Password:="not2day"
End If
' Set the language for the document.
Selection.WholeStory
Selection.LanguageID = wdEnglishUS
' Perform Spelling/Grammar check.
If Options.CheckGrammarWithSpelling = True Then
ActiveDocument.CheckGrammar
Else
ActiveDocument.CheckSpelling
End If
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
oStory.Fields.Update
If oStory.StoryType <> wdMainTextStory Then
While Not (oStory.NextStoryRange Is Nothing)
Set oStory = oStory.NextStoryRange
oStory.Fields.Update
Wend
End If
Next oStory
Set oStory = Nothing
' ReProtect the document.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If
End Sub