shortcut to insert line

L

Linda3365

In (dare I mention it?) WordPerfect, I had a shortcut to insert an underline
to the right-hand margin of the page. It was the handiest macro I had. Can it
be done in Word 2003?
 
J

Jay Freedman

In (dare I mention it?) WordPerfect, I had a shortcut to insert an underline
to the right-hand margin of the page. It was the handiest macro I had. Can it
be done in Word 2003?

Put this macro in your Normal.dot or another global template (see
http://www.gmayor.com/installing_macro.htm) and assign a keyboard
shortcut to it
(http://www.word.mvps.org/FAQs/Customization/AsgnCmdOrMacroToHotkey.htm).

Public Sub RightMarginUnderline()
Dim tabPos As Single
With Selection.Sections(1).PageSetup
tabPos = .PageWidth - .RightMargin - .LeftMargin
End With
With Selection
.Paragraphs(1).Range.Select
.MoveEnd Unit:=wdCharacter, Count:=-1
.Collapse wdCollapseEnd
.Paragraphs(1).TabStops.Add _
Position:=tabPos, _
Alignment:=wdAlignTabRight, _
Leader:=wdTabLeaderLines
.InsertAfter vbTab
End With
End Sub
 

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