I want to find a string in a word document and delete everything after it.
What is the best way to do this without using the Selection object?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use a
Rangeobject instead. Straight outta the Word 2003 help:Now use the
SetRangemethod of thatRangeobject to make the start of the range be the next character after the end of the string you searched for and make the end of the range be the end of the document:(TODO: You’ll need to deal with the case when your string is the last thing in the document)
To delete the contents: