View Single Post
 
Old 03-07-2016, 10:19 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2013
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,158
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

This seems to work for multiple levels of an outline list
Selection.Range.ListFormat.List.Range.Select

If you have restarted lists then the selection stays within the one block but if the numbering continues from a previous block then you end up selecting both blocks plus the bit in between.

So the macro to add a keep with next to the second last paragraph would be
Code:
Sub Mac2()
  Dim aRng As Range
  Set aRng = Selection.Range.ListFormat.List.Range
  If aRng.Paragraphs.Count > 1 Then
    aRng.Paragraphs(aRng.Paragraphs.Count - 1).KeepWithNext = True
  End If
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote