View Single Post
  #3   Report Post  
Jay Freedman
 
Posts: n/a
Default

If you're not familiar with macro code, it might not be obvious what
Greg's macro is doing. Unlike WordPerfect, Word relies on using a
tabstop -- either right-aligned or decimal -- at the right margin to
create flush-right text in a paragraph that's basically flush-left.
Once the tabstop is in place, type the text at the left, hit the Tab
key, and type the text at the right. You can do that manually, or you
can use the macro.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org

On Wed, 16 Mar 2005 19:30:16 -0500, "Greg Maxey"
wrote:

Teacher,

This macro makes it possible to flush right:
See: http://www.gmayor.com/installing_macro.htm

Sub FlushRight()

On Error GoTo ErrorHandling

Dim sngLeftMargin As Single 'left margin setting for current document
Dim sngRightMargin As Single 'right " " "
Dim sngPageWidth As Single 'page width " "
Dim sngWidthToRight As Single 'setting required for custom tab stop

'retrieve document's margin and page width settings
sngLeftMargin = CSng(ActiveDocument.PageSetup.LeftMargin)
sngRightMargin = CSng(ActiveDocument.PageSetup.RightMargin)
sngPageWidth = CSng(ActiveDocument.PageSetup.PageWidth)


sngWidthToRight = sngPageWidth - (sngLeftMargin + sngRightMargin)
Application.ScreenUpdating = False

With Selection
.Paragraphs.TabStops.Add _
Position:=sngWidthToRight, Alignment:=wdAlignTabRight,
Leader:=wdTabLeaderSpaces
.InsertAfter Text:=vbTab
.EndKey Unit:=wdLine

'ensure the next line has the default tab stop
If .Type = wdSelectionIP And _
.End = ActiveDocument.Content.End - 1 Then 'if no line below the current
Line
.TypeParagraph 'new line
Else 'move to the beginning of next line
.MoveDown _
Unit:=wdLine, _
Count:=1
End If

.ParagraphFormat.TabStops.ClearAll 'restore default tab stop
.MoveUp _
Unit:=wdLine, _
Count:=1 'move the insertion point...
.EndKey _
Unit:=wdLine '...to the right margin, ready for text
End With

Application.ScreenUpdating = True 'display on

ErrorHandling:
End Sub

--
Greg Maxey/Word MVP
A Peer in Peer to Peer Support
http://gregmaxey.mvps.org/word_tips.htm

TheTeacher wrote:
WordPerfect has a command,"flush right" which enables a set of
figures to be right justified while the rest of line is left
justified. Can this be done in Word, and if so, how?
Alex