Can "flush right" in WP be done in Word?

G

Guest

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
 
G

Greg Maxey

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
 
J

Jay Freedman

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.
 

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