![]() |
|
|
|
#1
|
||||
|
||||
|
This concept appears to work IF a heading is the trigger for each block of pages (ie a paragraph which has an outline level other than body text).
Code:
Sub RandomSortOfChap()
Dim aPar As Paragraph
'Add random numbers on headings
For Each aPar In ActiveDocument.Paragraphs
If aPar.Range.ParagraphFormat.OutlineLevel <> wdOutlineLevelBodyText Then
aPar.Range.InsertBefore Left(Rnd(1) * 100000, 4) & vbTab
End If
Next aPar
'Now sort based on the random number
ActiveWindow.ActivePane.View.Type = wdOutlineView
ActiveWindow.View.ShowHeading 5 'show five levels of headings
Selection.Sort FieldNumber:="Paragraphs", SortFieldType:=wdSortFieldAlphanumeric
ActiveWindow.ActivePane.View.Type = wdPrintView
'And remove the numbers
ActiveDocument.Range.Select
WordBasic.ToolsBulletsNumbers Replace:=0, Type:=1, Remove:=1
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| [Word VBA macro] How to open the website [languagetool.org] and check my Word document? | citroen | Word VBA | 0 | 10-25-2020 05:07 AM |
| Macro to transfer data from Word to another Word document with bookmark | Jovan Yong | Word VBA | 3 | 04-17-2018 04:27 AM |
| Macro to put 1 word of a MS Word file in 1 cell of a Word or Excel Table | Singh_Edm | Word VBA | 6 | 11-13-2015 08:48 PM |
Macro Question: Need help making a macro to highlight the first word in every sentence
|
LadyAna | Word | 1 | 12-06-2014 10:39 PM |
Word 2003 Macro problem running in Word 2010
|
norwood | Word VBA | 2 | 02-03-2014 06:49 PM |