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?





  #7   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,
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   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 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   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 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   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,
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   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?

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

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 09:12 PM.

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

About Us

"It's about Microsoft Word"