Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
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? |
#7
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Can I check the spelling in only one of multiple form fields?
Greg,
Many Thanks, it worked. I have just one additional thing to work out. When I tab out (exit) the field it takes me back to the first field in the form. The spelling is checked but I can not figure why it takes me back to that first field. If you have any suggestions, I would appreciate hearing them. Aldon "Greg Maxey" wrote: 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? |
#8
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Can I check the spelling in only one of multiple form fields?
Greg,
I appreciate your help greatly. It is listed below for the next person that needs an answer to the same problem. Sub CheckMeExit() Dim oRng As Word.Range ActiveDocument.Unprotect Password:="060305" Set oRng = ActiveDocument.FormFields("Text1").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, NoReset:=True ActiveDocument.Bookmarks("Text2").Range.Fields(1). Result.Select End Sub |
#9
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Can I check the spelling in only one of multiple form fields?
You are welcome. I see that you solved your second question. Sorry I
didn't get back to your earlier. I assume that your have heard the saw "Give a man a fish and he eats for a day...Teach a man to fish and he eats for a lifetime." Appears my neglect has made you learn to fish ;-). Trust me. I am not being arrogant. I have been given many fishes in these groups and while I catch some from time to time I still often beg for and I am spoon fed fish ;-). Aldon wrote: Greg, I appreciate your help greatly. It is listed below for the next person that needs an answer to the same problem. Sub CheckMeExit() Dim oRng As Word.Range ActiveDocument.Unprotect Password:="060305" Set oRng = ActiveDocument.FormFields("Text1").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, NoReset:=True ActiveDocument.Bookmarks("Text2").Range.Fields(1). Result.Select End Sub |
#10
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Can I check the spelling in only one of multiple form fields?
Greg,
Quite the contrary. I can imagine that I might have sounded somewhat arrogant when I told people at work that i finally got the form to work as we wanted. Thanks again, Aldon "Greg Maxey" wrote: You are welcome. I see that you solved your second question. Sorry I didn't get back to your earlier. I assume that your have heard the saw "Give a man a fish and he eats for a day...Teach a man to fish and he eats for a lifetime." Appears my neglect has made you learn to fish ;-). Trust me. I am not being arrogant. I have been given many fishes in these groups and while I catch some from time to time I still often beg for and I am spoon fed fish ;-). Aldon wrote: Greg, I appreciate your help greatly. It is listed below for the next person that needs an answer to the same problem. Sub CheckMeExit() Dim oRng As Word.Range ActiveDocument.Unprotect Password:="060305" Set oRng = ActiveDocument.FormFields("Text1").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, NoReset:=True ActiveDocument.Bookmarks("Text2").Range.Fields(1). Result.Select End Sub |
#11
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Can I check the spelling in only one of multiple form fields?
LOL. If there credit given or to be taken. Take it! ;-)
Aldon wrote: Greg, Quite the contrary. I can imagine that I might have sounded somewhat arrogant when I told people at work that i finally got the form to work as we wanted. Thanks again, Aldon "Greg Maxey" wrote: You are welcome. I see that you solved your second question. Sorry I didn't get back to your earlier. I assume that your have heard the saw "Give a man a fish and he eats for a day...Teach a man to fish and he eats for a lifetime." Appears my neglect has made you learn to fish ;-). Trust me. I am not being arrogant. I have been given many fishes in these groups and while I catch some from time to time I still often beg for and I am spoon fed fish ;-). Aldon wrote: Greg, I appreciate your help greatly. It is listed below for the next person that needs an answer to the same problem. Sub CheckMeExit() Dim oRng As Word.Range ActiveDocument.Unprotect Password:="060305" Set oRng = ActiveDocument.FormFields("Text1").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, NoReset:=True ActiveDocument.Bookmarks("Text2").Range.Fields(1). Result.Select End Sub |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How do I check spelling in a protected form? | Microsoft Word Help | |||
How do I check spelling in a text form field? | Microsoft Word Help | |||
Check box in Form Fields | Formatting Long Documents | |||
spell check form fields | Microsoft Word Help | |||
Word should let me check spelling when I am using a locked form. | Microsoft Word Help |