Is there a command to delete text after a certain point in a line

G

Greg Maxey

I don't think there is a built in command but you could assign a macro to
keyboard shortcut and do it:

Sub DeleteToEndofLing()
Dim oRng As Word.Range
Set oRng = ActiveDocument.Bookmarks("\line").Range
'Don't include the end of line mark.
If oRng.Characters.Last = vbCr Or oRng.Characters.Last = Chr(11) Then
oRng.MoveEnd wdCharacter, -1
End If
oRng.Start = Selection.Start
oRng.Delete
End Sub

--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org


Nov 4, 2008. Remember it well. You just might
spend your sunset years telling your children and
your children's children what it was once like in
the United States where men were free.
 
D

Doug Robbins - Word MVP

It can be done with some VBA code:

Dim myrange As Range
Set myrange = Selection.Paragraphs(1).Range
With myrange
.Start = Selection.Start
.End = .End - 1
.Delete
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
C

Cheryl Flanders

There are many built-in keyboard shortcuts that will select text, then
press Delete.

Shift + End highlights text from cursor point to the end of the
line.
Ctrl + Shift + Down Arrow highlights text from cursor point to the end
of a paragraph.
Extend Mode (F8) can highlight text to specific character or
punctuation.

Look up keyboard shortcuts in Word's Help file.

Cheryl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top