how to assign replacement text to string Variable?
In the following example I am doing a find and replace using a macro inside Word. At the bottom you can see that I assign the searched for text to the variable sText. How would I assign the replacement.tex t to a variable? So for example in this case the macro finds "To:" and replaces it with o. I would like to be able to assign "o" to a variable
Thank Rabbit for getting back to me. Sorry for not using the code tags but I will in the future. I have looked into using regular expressions. I did set my tools to the Microsoft VBScript Regular Expressions 5.5 library but it still won't let me search using "*".
In the code above I had tried to seach by inserting my variable and assigning the find method (
Code:
With sSample.Find
) I know that this is not correct but can you tell,...
how to use Word find and Replace to search inside a string
I am trying to figure out how to use the power of Word's Find and Replace to search inside of string variables and then replace the found sequence with something else or in some cases to remove the found item from the variable. I assumed that the following example code would work, in this case I thought it would find 5 numerical digits inside the string variable sSample and remove them but it doesn't seem to work
Leave a comment: