PDA

View Full Version : Solved: go to next in loop under conditions



OTWarrior
09-19-2007, 09:04 AM
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?

TonyJollans
09-19-2007, 09:26 AM
You can't force iteration of the loop like that but, with what you have posted you can just delete the line:


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

OTWarrior
09-20-2007, 01:00 AM
Perfect, is alot quicker now.
Thank you