Reply
 
Thread Tools Display Modes
  #1   Report Post  
TheTeacher
 
Posts: n/a
Default Can "flush right" in WP be done in Word?

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
  #2   Report Post  
Greg Maxey
 
Posts: n/a
Default

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



  #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



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing Documents in Word 2003 and Word 2002 - VERY Weird Proble Joshua Gray Microsoft Word Help 5 February 18th 05 10:09 PM
Converted document from WordPerfect. New footnotes are not being. C Lowman Microsoft Word Help 1 January 26th 05 11:19 PM
word xp crashes after macros are recorded kharris0405 Microsoft Word Help 3 January 11th 05 11:50 PM
How to change merge forms from Word Perfect to Microsoft Word dollfindance Microsoft Word Help 2 December 30th 04 04:35 PM
Macro that will add the file path & date to Word footnotes? Rich P Microsoft Word Help 2 December 15th 04 08:49 PM


All times are GMT +1. The time now is 01:33 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"