| View previous topic :: View next topic |
| Author |
Message |
Kathy Webster Guest
|
Posted: Tue Nov 13, 2007 8:32 pm Post subject: on not found |
|
|
How do I tell a word macro to search for a character string, and do x, y and
z. But if the character string is NOT found, go to the end of the sub? |
|
| Back to top |
|
 |
Google Sponsor

|
Posted: Tue Nov 13, 2007 8:32 pm Post subject: Advertisement |
|
|
|
|
| Back to top |
|
 |
Kathy Webster Guest
|
Posted: Tue Nov 13, 2007 8:43 pm Post subject: Re: on not found |
|
|
Found it on word.vba.beginners group...
If Selection.Find.Found = True Then
bla bla bla
End If
"Kathy Webster" <slickdock@yahoo.com> wrote in message
news:473a0a03$0$28816$4c368faf@roadrunner.com...
| Quote: | How do I tell a word macro to search for a character string, and do x, y
and z. But if the character string is NOT found, go to the end of the
sub?
|
|
|
| Back to top |
|
 |
Doug Robbins - Word MVP Guest
|
Posted: Tue Nov 13, 2007 9:29 pm Post subject: Re: on not found |
|
|
You can also use the Instr() function. It returns 0 if the string being
searched for is not found. Therefore
If Instr(string1, string2) = 0 Then ' string1 does not contain string2
Exit Sub
Else
'Do x, y and z
End If
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP
"Kathy Webster" <slickdock@yahoo.com> wrote in message
news:473a0cc3$0$16446$4c368faf@roadrunner.com...
| Quote: | Found it on word.vba.beginners group...
If Selection.Find.Found = True Then
bla bla bla
End If
"Kathy Webster" <slickdock@yahoo.com> wrote in message
news:473a0a03$0$28816$4c368faf@roadrunner.com...
How do I tell a word macro to search for a character string, and do x, y
and z. But if the character string is NOT found, go to the end of the
sub?
|
|
|
| Back to top |
|
 |
|