how to state a textstring with a * wildcard - TechRepublic
Question
March 24, 2008 at 04:30 AM
c.s.adolfsson

how to state a textstring with a * wildcard

by c.s.adolfsson . Updated 18 years, 2 months ago

Hi.
I am creating a macro, that will detete a text starting with “START” and ending with “END”. In between it can be whatever. How do I state that in my macro? I can make it delete a specific string, but haw do I use “*” When I state the text string to search for?

This is what I have so far:

Sub wordmacro()

Dim strSearch As String
Dim rgeStart As Range

Set rgeStart = Selection.Range

strSearch = “Start * end”

‘ ABOVE I NEED THE CORRECT STRING!!!!

With ActiveDocument.Range.Find
.Text = strSearch
Do While .Execute
With .Parent
.Select
With Selection
.Range.Delete
.Characters(1).Delete
End With
End With
Loop
End With

rgeStart.Select

Application.Browser.Target = wdBrowsePage

End Sub

This discussion is locked

All Comments