shortcut to insert line

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
 
Back
Top