![]() |
#7
|
||||
|
||||
![]()
Try something along the following lines:
Code:
Sub Demo() Application.ScreenUpdating = True Dim i As Long With Selection For i = 1 To .Paragraphs.Count With .Paragraphs(i).Range.Characters.First Select Case Int(PointsToInches(.Information(wdHorizontalPositionRelativeToTextBoundary)) * 4) Case 1: .InsertBefore vbTab Case 2: .InsertBefore vbTab & vbTab Case 3: .InsertBefore vbTab & vbTab & vbTab Case 4: .InsertBefore vbTab & vbTab & vbTab & vbTab Case 5: .InsertBefore vbTab & vbTab & vbTab & vbTab & vbTab Case 6: .InsertBefore vbTab & vbTab & vbTab & vbTab & vbTab & vbTab Case 7: .InsertBefore vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab Case 8: .InsertBefore vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab Case 9: .InsertBefore vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab & vbTab End Select End With Next .ParagraphFormat.Alignment = wdAlignParagraphLeft .ClearParagraphAllFormatting End With Application.ScreenUpdating = True End Sub Code:
Sub Demo() Application.ScreenUpdating = True Dim i As Long, j As Long, StrTmp As String With Selection For i = 1 To .Paragraphs.Count StrTmp = vbNullString With .Paragraphs(i).Range.Characters.First For j = 0 To Int(PointsToInches(.Information(wdHorizontalPositionRelativeToTextBoundary)) * 4) StrTmp = StrTmp & vbTab Next .InsertBefore StrTmp End With Next .ParagraphFormat.Alignment = wdAlignParagraphLeft .ClearParagraphAllFormatting End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] Last edited by macropod; 02-24-2014 at 09:49 PM. Reason: Alternative macro |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Catty | Word VBA | 1 | 12-11-2013 03:57 PM |
Words in my document were converted to numbers???? | MikeD23 | Word | 1 | 08-26-2012 11:09 AM |
Can you see how much time I worked on Word 2007/2010 document when converted to PDF? | Papa Bear | Word | 1 | 08-14-2012 05:14 AM |
My plain text post got converted to rich text in a reply, how to convert it back? | david.karr | Outlook | 0 | 01-05-2012 09:46 AM |
![]() |
gonner | Word | 1 | 09-10-2011 03:25 AM |