![]() |
#20
|
||||
|
||||
![]() Quote:
Quote:
Working with the document attached to your original post, I've written the macro at the end of this post. Run it and it will convert all those troublesome page columns to tables that are much easier to work with. The only portion I think you'll have to do some editing work on beforehand, in the one with the APOPKA, ORLANDO, etc addresses on the first page. That's because that Section has a curious mix of three columns for the four addresses, with two tab-separated address in the first column. To fix the portion with the APOPKA & ORLANDO addresses, I suggest: 1. Insert a paragraph break after 'Rm31 0' (yes, there's a space in '310') 2. Select both sets of addresses, then choose Insert>Table>Convert Text to table and press OK 3. Copy the APOPKA column & paste into Notepad 4. Copy the ORLANDO column & paste into Notepad 5. Delete the table (table Tools|Layout>Delete>Table 6. Choose Page Layout>Columns>More Columns 7. Set the # columns to 4 and check the 'Equal columns width box, the OK 8. Choose Page Layout>Breaks>Column 9. Copy the APOPKA address from NotePad & paste before the 1st column break 10. Copy the ORLANDO address from NotePad & paste before the 2nd column break You're now ready to run the macro. For PC macro installation & usage instructions, see: http://www.gmayor.com/installing_macro.htm Code:
Sub ConvertPageColumnsToTables() Application.ScreenUpdating = False Dim i As Long, j As Long, k As Long, Rng As Range, Tbl As Table With ActiveDocument With .Range .Fields.Unlink .InsertAfter vbCr .Sections.Add .Characters.Last, wdSectionContinuous End With With .Sections(.Sections.Count) .PageSetup.TextColumns.SetCount NumColumns:=1 .Range.Style = wdStyleNormal End With For i = .Sections.Count To 1 Step -1 With .Sections(i) j = .PageSetup.TextColumns.Count If j > 1 Then Set Rng = .Range With Rng .Collapse wdCollapseEnd End With Set Tbl = .Range.Tables.Add(Rng, 1, j) For k = 1 To j Set Rng = .Range With Rng If InStr(.Text, Chr(14)) > 0 Then .Collapse wdCollapseStart .MoveEndUntil Chr(14) Else .Collapse wdCollapseStart .MoveEndUntil Chr(12) End If End With Tbl.Range.Cells(k).Range.FormattedText = Rng.FormattedText With Rng .End = .End + 1 .Text = vbNullString End With Next End If End With Next End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
mikeman | Word VBA | 1 | 10-26-2014 10:35 PM |
![]() |
bookbean | Word Tables | 3 | 02-06-2013 04:55 PM |
![]() |
fiedlerw01 | Word | 1 | 10-23-2012 04:10 AM |
2 page document printing problem, text from page 1 in layout of page 2 when printed | laurawether45 | Word | 1 | 08-02-2012 07:03 AM |
Need guidance with formatting | pewe | Word | 4 | 11-22-2011 11:56 AM |