go to next in loop under conditions

  • Thread starter OTWarrior via OfficeKB.com
  • Start date
O

OTWarrior via OfficeKB.com

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?
 
J

Jay Freedman

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

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
O

OTWarrior via OfficeKB.com

Thank you, that works perfectly :)

Jay said:
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
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top