brothertruffle880
asked on
Word VBA
I have a string of text. Somewhere in that string there's a < (greater than character ). I would like to delete everthing from my current cursor position to the greater than character.
My cursor is at the beginning of the line
What is the VBA code to do this?
My cursor is at the beginning of the line
What is the VBA code to do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think this should do it:
Sub DelTillGT()
Dim rng As Range
Set rng = Selection.Range.Duplicate
rng.End = ActiveDocument.Range.End
With rng.Find
.Text = "*\>"
.MatchWildcards = True
.Replacement.Text = ""
.Execute Replace:=wdReplaceOne
End With
End Sub
brothertruffle880,
Have you missed off the end of Rgonzo's code?
Have you missed off the end of Rgonzo's code?
ASKER
Here's an example of what I want (apologies for earllier typo. I should have said LESS THAN sign, not GREATER THAN
Candy Apple < Needed text1
Chocolate Apple < needed text2
Vanilla Apple < needed text3
At the end of the process, I want to have the following:
needed text1
needed text2
needed text3
I want everything deleted from the beginning of each line up to the less than sign.
I have a string of text. Somewhere in that string there's a < (less than character ). I would like to delete everthing from my current cursor position to the greater than character.
My cursor is at the beginning of the line
What is the VBA code to do this?
Candy Apple < Needed text1
Chocolate Apple < needed text2
Vanilla Apple < needed text3
At the end of the process, I want to have the following:
needed text1
needed text2
needed text3
I want everything deleted from the beginning of each line up to the less than sign.
I have a string of text. Somewhere in that string there's a < (less than character ). I would like to delete everthing from my current cursor position to the greater than character.
My cursor is at the beginning of the line
What is the VBA code to do this?
ASKER
Holy cow Rgonzo! Your posting corrected itself.
Now I see the entire thing!
A few minutes ago there was a dangling plus sign at te end of the code.
Let me try the clean post I just saw.
Now I see the entire thing!
A few minutes ago there was a dangling plus sign at te end of the code.
Let me try the clean post I just saw.
ASKER
Rgonzo. It worked. Thanks!
ASKER
Does the plus sign connect with anything? I'm getting red when I paste that into my VBE