×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Word 2010 Text Form Spell Checking working! How to set to run always on first field?

Word 2010 Text Form Spell Checking working! How to set to run always on first field?

Word 2010 Text Form Spell Checking working! How to set to run always on first field?

(OP)
So after an extensive amount of research over several months, I cam across the code to finally check the text form fields in a Word Form. The only issue with it is that it won't always start at the top of the document in the text field. The code will eventually get to the field which is good.

1) is there a way to automatically start at the first field instead of somewhere else?
2) When you press the cancel button when the spell check is working, it won't cancel / end the spell checker until it has gone through the complete document. Is there a way to resolve this?
3) On occasion, the spell checker will check the same field multiple times if the ignore once button is pressed. Is there a way to prevent this?

Other than those 3 points, the code works great!

Here is the original page with the instructions as reference: http://www.vbaexpress.com/kb/getarticle.php?kb_id=...

Code:

CODE

Sub spellcheck2()


If MsgBox("Would you like to spell check?", vbYesNo, "Spell Check") = vbYes Then

MsgBox ("The screen may flash while Spell Check is Running")
       
             
                Dim iCnt As Integer
            
            
             ActiveDocument.Unprotect Password:="test"
            
            
            For iCnt = 1 To ActiveDocument.FormFields.Count
                         'Select formfield
                        ActiveDocument.FormFields(iCnt).Select
                         
                        #If VBA6 Then
                             'Only Word > 2000
                            Selection.NoProofing = False
                        #End If
                         'Set Language
                        Selection.LanguageID = wdEnglishUS
                         'Run spell checker
                        Selection.Range.CheckSpelling
            
            Next
            

            
            ActiveDocument.Protect Type:=wdAllowOnlyFormFields, Noreset:=True, Password:="test"

MsgBox ("Spell Check is complete")

Else

End If




End Sub 

RE: Word 2010 Text Form Spell Checking working! How to set to run always on first field?

Hi,

Select the first word in the document before your current process starts.

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Word 2010 Text Form Spell Checking working! How to set to run always on first field?

(OP)
Hi Skip,

Since the document is locked as a form, I am not sure as to how that can be done. Also, this form is going to suppliers and I don't think that I want to place instructions on how to do that.

Any suggestions on maybe using the count of fields to have it start at the first one always?

Thanks!

RE: Word 2010 Text Form Spell Checking working! How to set to run always on first field?

How about...

CODE

ActiveDocument.FormFields(1).Select 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Word 2010 Text Form Spell Checking working! How to set to run always on first field?

The index will be in order of creation. Not necessarily the same as sequence within the document.

RE: Word 2010 Text Form Spell Checking working! How to set to run always on first field?

CODE

Dim sFirstField As String

sFirstField = “first field name’remig, put the first field name here

ActiveDocument.FormFields(sFirstField).Select 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Word 2010 Text Form Spell Checking working! How to set to run always on first field?

(OP)
Hi Skip,

I have some questions.

1) Since it is a legacy form field, would it be the bookmark name? (example = text13)

2) Where would I put the code in my code? I am not terribly advanced in coding and I just seem to be able to able to cobble things together and somehow make it work.

CODE

sFirstField = “first field name”   ’remig, put the first field name here

ActiveDocument.FormFields(sFirstField).Select 

Thanks guys!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close