Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Aldon Aldon is offline
external usenet poster
 
Posts: 9
Default Can I check the spelling in only one of multiple form fields?

I have found macros that check every form field in the form. I need to check
only one form field because other fields contain info that will always be
incorrectly spelled. Does someone have a macro that will successfully check
the one field based on the bookmark name or any other reference?
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 171
Default Can I check the spelling in only one of multiple form fields?

You might adapt this to your needs:

Sub CheckMe()
Dim oRng As Word.Range
ActiveDocument.Unprotect
Set oRng = ActiveDocument.FormFields("Your Field BM name").Range
oRng.NoProofing = False
If oRng.SpellingErrors.Count 0 Then
ActiveDocument.Bookmarks("Your Field BM
Name").Range.Fields(1).Result.Select
MsgBox "Spelling error!"
End If
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub

and run it on exit from the field.



Aldon wrote:
I have found macros that check every form field in the form. I need to check
only one form field because other fields contain info that will always be
incorrectly spelled. Does someone have a macro that will successfully check
the one field based on the bookmark name or any other reference?


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Aldon Aldon is offline
external usenet poster
 
Posts: 9
Default Can I check the spelling in only one of multiple form fields?

Greg,
I tested the macro. I am not sure if it did anything. It did not provide
the message nor did it highlight the misspelled words. The macro below does
the job but checks any text in the document.


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

' ReProtect the document.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If

End Sub


If I knew more about VBA I might be able to select only the one field that
needs to be checked.

Aldon

"Greg Maxey" wrote:

You might adapt this to your needs:

Sub CheckMe()
Dim oRng As Word.Range
ActiveDocument.Unprotect
Set oRng = ActiveDocument.FormFields("Your Field BM name").Range
oRng.NoProofing = False
If oRng.SpellingErrors.Count 0 Then
ActiveDocument.Bookmarks("Your Field BM
Name").Range.Fields(1).Result.Select
MsgBox "Spelling error!"
End If
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub

and run it on exit from the field.



Aldon wrote:
I have found macros that check every form field in the form. I need to check
only one form field because other fields contain info that will always be
incorrectly spelled. Does someone have a macro that will successfully check
the one field based on the bookmark name or any other reference?



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 171
Default Can I check the spelling in only one of multiple form fields?

Aldon,

Did you change the index name "Your field BM name" to match the name of
your field?

Try this one:

Sub CheckMeExit()
Dim oRng As Word.Range
ActiveDocument.Unprotect
Set oRng = ActiveDocument.FormFields("Text1").Range
oRng.NoProofing = False
oRng.CheckSpelling
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub

Set the macro to run on exit from a field bookmarked "Text1"






Aldon wrote:
Greg,
I tested the macro. I am not sure if it did anything. It did not provide
the message nor did it highlight the misspelled words. The macro below does
the job but checks any text in the document.


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

' ReProtect the document.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If

End Sub


If I knew more about VBA I might be able to select only the one field that
needs to be checked.

Aldon

"Greg Maxey" wrote:

You might adapt this to your needs:

Sub CheckMe()
Dim oRng As Word.Range
ActiveDocument.Unprotect
Set oRng = ActiveDocument.FormFields("Your Field BM name").Range
oRng.NoProofing = False
If oRng.SpellingErrors.Count 0 Then
ActiveDocument.Bookmarks("Your Field BM
Name").Range.Fields(1).Result.Select
MsgBox "Spelling error!"
End If
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub

and run it on exit from the field.



Aldon wrote:
I have found macros that check every form field in the form. I need to check
only one form field because other fields contain info that will always be
incorrectly spelled. Does someone have a macro that will successfully check
the one field based on the bookmark name or any other reference?




  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Aldon Aldon is offline
external usenet poster
 
Posts: 9
Default Can I check the spelling in only one of multiple form fields?

Greg,
I tried that and it did not work. I used portions of another macro that I
found and it still does not work. This is what I last used

Sub CheckMeExit()

Dim oRng As Word.Range
ActiveDocument.Unprotect Password:="******"
Set oRng = ActiveDocument.FormFields("underlying").Range
oRng.NoProofing = False
If Options.CheckGrammarWithSpelling = True Then
oRng.CheckGrammar
Else
oRng.CheckSpelling
End If

If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If

End Sub

"Greg Maxey" wrote:

Aldon,

Did you change the index name "Your field BM name" to match the name of
your field?

Try this one:

Sub CheckMeExit()
Dim oRng As Word.Range
ActiveDocument.Unprotect
Set oRng = ActiveDocument.FormFields("Text1").Range
oRng.NoProofing = False
oRng.CheckSpelling
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub

Set the macro to run on exit from a field bookmarked "Text1"






Aldon wrote:
Greg,
I tested the macro. I am not sure if it did anything. It did not provide
the message nor did it highlight the misspelled words. The macro below does
the job but checks any text in the document.


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

' ReProtect the document.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If

End Sub


If I knew more about VBA I might be able to select only the one field that
needs to be checked.

Aldon

"Greg Maxey" wrote:

You might adapt this to your needs:

Sub CheckMe()
Dim oRng As Word.Range
ActiveDocument.Unprotect
Set oRng = ActiveDocument.FormFields("Your Field BM name").Range
oRng.NoProofing = False
If oRng.SpellingErrors.Count 0 Then
ActiveDocument.Bookmarks("Your Field BM
Name").Range.Fields(1).Result.Select
MsgBox "Spelling error!"
End If
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub

and run it on exit from the field.



Aldon wrote:
I have found macros that check every form field in the form. I need to check
only one form field because other fields contain info that will always be
incorrectly spelled. Does someone have a macro that will successfully check
the one field based on the bookmark name or any other reference?






  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Greg Maxey Greg Maxey is offline
external usenet poster
 
Posts: 171
Default Can I check the spelling in only one of multiple form fields?

Aldon,

It worked for me. Here is a modified version of your macro. Make sure
ToolsOptionsCheck Spelling as you type is set.

Sub CheckMeExit()
Dim oRng As Word.Range
ActiveDocument.Unprotect Password:="******"
Set oRng = ActiveDocument.FormFields("underlying").Range
oRng.NoProofing = False
If Options.CheckSpellingAsYouType = True Then
oRng.CheckSpelling
Else
MsgBox "You don't have your options set to check spelling as you
type."
End If
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub


Aldon wrote:
Greg,
I tried that and it did not work. I used portions of another macro that I
found and it still does not work. This is what I last used

Sub CheckMeExit()

Dim oRng As Word.Range
ActiveDocument.Unprotect Password:="******"
Set oRng = ActiveDocument.FormFields("underlying").Range
oRng.NoProofing = False
If Options.CheckGrammarWithSpelling = True Then
oRng.CheckGrammar
Else
oRng.CheckSpelling
End If

If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If

End Sub

"Greg Maxey" wrote:

Aldon,

Did you change the index name "Your field BM name" to match the name of
your field?

Try this one:

Sub CheckMeExit()
Dim oRng As Word.Range
ActiveDocument.Unprotect
Set oRng = ActiveDocument.FormFields("Text1").Range
oRng.NoProofing = False
oRng.CheckSpelling
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub

Set the macro to run on exit from a field bookmarked "Text1"






Aldon wrote:
Greg,
I tested the macro. I am not sure if it did anything. It did not provide
the message nor did it highlight the misspelled words. The macro below does
the job but checks any text in the document.


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

' ReProtect the document.
If ActiveDocument.ProtectionType = wdNoProtection Then
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
End If

End Sub


If I knew more about VBA I might be able to select only the one field that
needs to be checked.

Aldon

"Greg Maxey" wrote:

You might adapt this to your needs:

Sub CheckMe()
Dim oRng As Word.Range
ActiveDocument.Unprotect
Set oRng = ActiveDocument.FormFields("Your Field BM name").Range
oRng.NoProofing = False
If oRng.SpellingErrors.Count 0 Then
ActiveDocument.Bookmarks("Your Field BM
Name").Range.Fields(1).Result.Select
MsgBox "Spelling error!"
End If
ActiveDocument.Protect wdAllowOnlyFormFields, True
End Sub

and run it on exit from the field.



Aldon wrote:
I have found macros that check every form field in the form. I need to check
only one form field because other fields contain info that will always be
incorrectly spelled. Does someone have a macro that will successfully check
the one field based on the bookmark name or any other reference?





Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I check spelling in a protected form? gem Microsoft Word Help 2 March 16th 06 02:58 PM
How do I check spelling in a text form field? D Microsoft Word Help 1 August 15th 05 06:51 PM
Check box in Form Fields Regina Formatting Long Documents 2 May 16th 05 08:00 PM
spell check form fields GIF Microsoft Word Help 2 December 8th 04 08:33 PM
Word should let me check spelling when I am using a locked form. Cheryl Microsoft Word Help 3 November 29th 04 04:19 PM


All times are GMT +1. The time now is 12:07 AM.

Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"