Use the Replace function, replacing the small string with nothing:
Selection.Text = Replace(Selection.Text, smallString, "")
If the small string doesn't occur in the selection, nothing will
happen (strictly speaking, the selection is replaced with itself). If
the small string occurs one or more times, all occurrences will be
removed at once.
The Replace function isn't available in Word 97 VBA, so if you need to
support that version, look in Google Groups for a way to write a
function that does the same thing.
--
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.
>If there is a smaller string in a larger string, I want to delete the
>smaller string. Is it possible to do this? I've tried simply making
[quoted text clipped - 9 lines]
>
>Thanks.
Larry - 19 Dec 2006 01:58 GMT
Thanks Jay.
Larry
> Use the Replace function, replacing the small string with nothing:
>
[quoted text clipped - 29 lines]
> >
> >Thanks.