Set F12 to delete line; how?

G

Graham Mayor

What constitutes a 'line' in this context. A line is a transient thing the
length of which depends on a number of factors. How are you determining what
is on the 'line' that you wish to delete?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
C

Cherri

Graham, thanks so much. Example: the second line of your post below, a
line of text ("...length of which...").

When I'm composing in MS Word, I would like to use the F12 key to delete a
line of text immediately below the line I am working on. I guess an easier
way of describing this is I want to "suck up" unwanted text by entire line of
text, not just a character.

Does this make sense? Sorry, I'm not technically-vocabularized.

Thanks again for reading/responding to my post.

Cherri
 
H

Helmut Weber

Hi Cherri,

a million ways to delete the next line,
and a million complications.

This is just a working solution.
Handle with care!

Sub DeleteNextLine()
Dim rTmp As Range
' remember the selection
Set rTmp = selection.Range
With selection
.GoTo _
what:=wdGoToLine, _
which:=wdGoToNext, _
Count:=1
.Bookmarks("\line").Range.Delete
End With
'restore the selection
rTmp.Select
End Sub

Hoping, assigning a shortcut to it would not be a problem.


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
C

Cherri

Helmut,

Willhandle wth care. thanks.

(although wish there were a simpler way to do this....:)
 
H

Helmut Weber

Hi Cherri;
(although wish there were a simpler way to do this....:)

it is even more complicated,
as my code deletes the actual line,
if there is no next line. :-(

HTH, nevertheless

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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