Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2007

Tip: Looking for answers? Try searching our database.

go to next in loop under conditions

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
OTWarrior - 19 Sep 2007 17:04 GMT
I need to search many form fields in order to spellcheck them, and want the
spell check to pass over it if the formfield is empty, how would I do this?

I have tried this:
**************************
For Each FmFld In oSection.Range.FormFields
   Set MyRange = FmFld.Range
   If FmFld.Result = "" Then
   Next FmFld
Else
    'doloop
End If
Next fmfld
********************************

but to no avail. what would i use instead of next fmfld in this case? or are
you not able to go back to the manually force the loop to go over it's next
option?
Jay Freedman - 19 Sep 2007 19:06 GMT
An IF statement doesn't necessarily have an ELSE clause. Use the
construction below. If the condition is false (that is, if the field is
empty), execution simply drops down to the End If and then to the Next
fmfld.

For Each FmFld In oSection.Range.FormFields
   Set MyRange = FmFld.Range
   If FmFld.Result <> "" Then
      'doloop
   End If
Next fmfld

Signature

Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

> I need to search many form fields in order to spellcheck them, and
> want the spell check to pass over it if the formfield is empty, how
[quoted text clipped - 15 lines]
> or are you not able to go back to the manually force the loop to go
> over it's next option?
OTWarrior - 20 Sep 2007 13:55 GMT
Thank you, that works perfectly :)

>An IF statement doesn't necessarily have an ELSE clause. Use the
>construction below. If the condition is false (that is, if the field is
[quoted text clipped - 13 lines]
>> or are you not able to go back to the manually force the loop to go
>> over it's next option?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.