![]() |
|
#1
|
||||
|
||||
![]()
It's a bit unpredictable without access to the document, but the following will loop through the paragraphs.
Code:
Sub TabToEndOfLine() Dim lngWidth As Long, lngLM As Long, lngRM As Long Dim oRng As Range Dim oPara As Paragraph For Each oPara In ActiveDocument.Paragraphs If oPara.Range.Information(wdWithInTable) = False Then Set oRng = oPara.Range With oRng.Sections(1).PageSetup lngLM = .LeftMargin lngRM = .RightMargin lngWidth = .PageWidth End With oRng.End = oRng.End - 1 With oRng.ParagraphFormat.TabStops .ClearAll .Add Position:=lngWidth - lngLM - lngRM, _ Alignment:=wdAlignTabRight, _ Leader:=2 End With oRng.Collapse 0 oRng.Text = Chr(32) & vbTab End If DoEvents Next oPara lbl_Exit: Set oRng = Nothing Set oPara = Nothing Exit Sub End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
![]() |
Tags |
hyphen |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Hyphen goes to next line | DBlomgren | Publisher | 0 | 07-14-2016 06:46 PM |
Bibliography Hyphen for repeat author | grantgibson45 | Word | 3 | 02-25-2013 04:32 AM |
Switching text on either side of hyphen | nignog | Word | 1 | 01-23-2012 01:13 PM |
![]() |
gstech | Word | 1 | 10-08-2010 09:57 AM |
Hyphen vs. en-dash | tocuin | Word | 0 | 09-18-2009 10:01 AM |