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?
brothertruffle880Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Rgonzo1971Commented:
HI,

pls try ( greater is >, if not what you want pls correct code)

Set myRange = Selection.Paragraphs(1).Range
myRange.Text = Mid(myRange.Text, InStr(1, myRange.Text, ">") + 1)

Open in new window

Regards

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
brothertruffle880Author Commented:
Hi Rgonzo:
Does the plus sign connect with anything?  I'm getting red when I paste that into my VBE
GrahamSkanRetiredCommented:
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

Open in new window

Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

GrahamSkanRetiredCommented:
brothertruffle880,
Have you missed off the end of Rgonzo's code?
brothertruffle880Author Commented:
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?
brothertruffle880Author Commented:
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.
brothertruffle880Author Commented:
Rgonzo.  It worked.  Thanks!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.