How to: Remove Parts of a String (Visual Basic)
The following code example removes all occurrences of one string from another string.
This example uses the Replace function to replace each occurrence of the substring with an empty string. The result is a new string with the substrings removed.
The example assigns the return value of the Replace function to the string variable withoutParts. The original string, stored in withParts, is not changed.
Compiling the Code
Replace "Books and Chapters and Pages" with the string you want to manipulate.