![]() |
|
|
|
#1
|
|||
|
|||
|
Anyone know of any macro code or way to reverse about 100 headings in a Word 2007 Document?
I want to change the headings (representing by letters) into reverse order so that CCCC 5 6 BBBB 3 4 AAAA 1 2 becomes AAAA 1 2 BBBB 3 4 CCCC 5 6 |
|
#2
|
|||
|
|||
|
I found the code below but it turns
BBBB 3 4 AAAA 1 2 into the following AAAA 2 1 BBBB 4 3 instead of AAAA 1 2 BBBB 3 4 Any ideas? Sub reverseheadings() ' ' reverseheadings Macro ' ' Dim iPara As Long Dim iLastPara As Long Dim doc As Document Dim docNew As Document Dim rng As Range Set doc = ActiveDocument Set docNew = Documents.Add iLastPara = doc.Paragraphs.Count Set paraHeader = docNew.Paragraphs.Add paraHeader.Style = "Heading 1" For iPara = doc.Paragraphs.Count To 1 Step -1 If doc.Paragraphs(iPara).Style = "Heading 1" Then paraHeader.Range = doc.Paragraphs(iPara).Range.Sentences(1) Set paraHeader = docNew.Paragraphs.Add paraHeader.Style = "Heading 1" iLastPara = iPara - 1 End If If doc.Paragraphs(iPara).Style = "Normal" Then Set rng = doc.Paragraphs(iPara).Range rng.Select Selection.Copy Set rng = docNew.Range rng.Collapse wdCollapseEnd rng.Select rng.Paste iLastPara = iPara - 1 End If Next iPara End Sub |
|
| Tags |
| headings, order, reverse |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Inbox Account Order | pmokover | Outlook | 0 | 08-04-2010 09:34 PM |
| Office 2007 Ribbon Change Cannot Reverse | Russ | Office | 0 | 04-29-2010 01:59 AM |
Reversing Text Order
|
weemikey | Word | 4 | 08-05-2009 11:10 AM |
Order of Service
|
sparky3883 | Word | 1 | 11-17-2008 11:11 PM |
| sub headings | mahound | Word | 2 | 08-20-2008 12:55 PM |