CaptainCsaba
Board Regular
- Joined
- Dec 8, 2017
- Messages
- 78
Hi!
This actually appeared in Word VBA. I have a code that changed text tot other text. The problem is the text is almost always the same, there is one word inside it that always differs so I tried to use the * symbol and it does not work.
(^p is a paragraph end symbol)
If i put something like "apples" in the place of * it works fine but like this it does not. No matter what is inside the place of "*" it should work and change the beginning of the sentence. Even Microsoft says this on their official site:
"For example, a midsummer * dream will return results that contain the exact phrase, a midsummer night’s dream."
Does anybody has an idea what I should use instead of * to indicate to VBA that anything could be there?
This actually appeared in Word VBA. I have a code that changed text tot other text. The problem is the text is almost always the same, there is one word inside it that always differs so I tried to use the * symbol and it does not work.
Code:
Sub ChangeText()
With Selection.Find
.ClearFormatting
.Text = "Mary had two little *^p in her basket"
.Replacement.ClearFormatting
.Replacement.Text = "Johnny had three little *^p in his basket"
.Execute Replace:=wdReplaceAll, Forward:=True, _
Wrap:=wdFindContinue
End With
End Sub
(^p is a paragraph end symbol)
If i put something like "apples" in the place of * it works fine but like this it does not. No matter what is inside the place of "*" it should work and change the beginning of the sentence. Even Microsoft says this on their official site:
"For example, a midsummer * dream will return results that contain the exact phrase, a midsummer night’s dream."
Does anybody has an idea what I should use instead of * to indicate to VBA that anything could be there?