OTWarrior
09-21-2007, 05:38 AM
I have modified some code from a spellchecker than can check form fields (I have changed it to run when you exit each form field, rather than checking everything)
However, it does slot of flickering when you run it, and I have to be careful of people with epilepsy in the work place.
I was wondering whta part of the code is causing it, I think it may be the turning on and off of the protection, but I don't know a way around it. The even weirder thing is it seems to go to the very first form field, and then to the one you are exiting to (ie, if you are in box3, and click box5, it will flicker as it goes to box1, then flicker as it goes to box5)
Public Sub proofing()
If Selection.FormFields.Count = 1 Then
'No textbox but a check- or listbox
BKMName0 = Selection.FormFields(1).Name
ResultCheck0 = ActiveDocument.FormFields(BKMName0).Result
ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count > 0 Then
BKMName0 = Selection.Bookmarks(Selection.Bookmarks.Count).Name
ResultCheck0 = ActiveDocument.FormFields(BKMName0).Result
End If
ActiveDocument.FormFields(BKMName0).Range.NoProofing = False
End Sub
Public Sub SpellChqer()
If ActiveDocument.FormFields(BKMName0).Result = "" Then
Else
If ActiveDocument.ProtectionType <> wdNoProtection Then
bprotected = True
ActiveDocument.Unprotect Password:=""
End If
Set MyRange = ActiveDocument.FormFields(BKMName0).Range
MyRange.CheckSpelling
'ActiveDocument.FormFields(BKMName0).Range.CheckSpelling
'MyRange.CheckSpelling
If bprotected = True Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End If
End If
ActiveDocument.FormFields(BKMName0).Select
End Sub
However, it does slot of flickering when you run it, and I have to be careful of people with epilepsy in the work place.
I was wondering whta part of the code is causing it, I think it may be the turning on and off of the protection, but I don't know a way around it. The even weirder thing is it seems to go to the very first form field, and then to the one you are exiting to (ie, if you are in box3, and click box5, it will flicker as it goes to box1, then flicker as it goes to box5)
Public Sub proofing()
If Selection.FormFields.Count = 1 Then
'No textbox but a check- or listbox
BKMName0 = Selection.FormFields(1).Name
ResultCheck0 = ActiveDocument.FormFields(BKMName0).Result
ElseIf Selection.FormFields.Count = 0 And Selection.Bookmarks.Count > 0 Then
BKMName0 = Selection.Bookmarks(Selection.Bookmarks.Count).Name
ResultCheck0 = ActiveDocument.FormFields(BKMName0).Result
End If
ActiveDocument.FormFields(BKMName0).Range.NoProofing = False
End Sub
Public Sub SpellChqer()
If ActiveDocument.FormFields(BKMName0).Result = "" Then
Else
If ActiveDocument.ProtectionType <> wdNoProtection Then
bprotected = True
ActiveDocument.Unprotect Password:=""
End If
Set MyRange = ActiveDocument.FormFields(BKMName0).Range
MyRange.CheckSpelling
'ActiveDocument.FormFields(BKMName0).Range.CheckSpelling
'MyRange.CheckSpelling
If bprotected = True Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True, Password:=""
End If
End If
ActiveDocument.FormFields(BKMName0).Select
End Sub