![]() |
#1
|
||||
|
||||
![]()
I need a macro to toggle the document outline level so I can more easily move document sections around. The macro would query the document layout and the paragraph outline level.
Here's the logic: If the document is in Normal (or Page) view and the cursor is on a heading, the macro would switch to outline view and set the document outline view level to the paragraph outline level so that it could be moved up or down amongst its peers using the Alt+Shift+Up/Down shortcut. If the document is in Outline view, the macro would set the document outline view to "All" and switch back to Normal layout. For any other combination, the macro would do nothing. Here's the code, which seems to work. Does anyone have any comments: Code:
Sub MyOutlineLevel() Dim DocLayout Dim ParOutline DocLayout = ActiveWindow.View ParOutline = Selection.Paragraphs(1).OutlineLevel Select Case DocLayout Case wdNormalView, wdPrintView If ParOutline = 10 Then Exit Sub Else ActiveWindow.View.ShowHeading ParOutline End If ActiveWindow.View.Type = wdOutlineView Case wdOutlineView ActiveWindow.View.ShowAllHeadings ActiveWindow.View.Type = wdNormalView Case Else Exit Sub End Select End Sub |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Jennifer Murphy | Word VBA | 1 | 01-18-2014 01:20 AM |
![]() |
bburns | Word | 10 | 07-16-2013 02:34 AM |
Macro to toggle outline level | Jennifer Murphy | Word VBA | 0 | 07-08-2013 08:20 AM |
![]() |
Jamal NUMAN | Word | 1 | 04-15-2011 06:26 PM |
Outline level to Body Text | dariober | Word | 0 | 08-23-2010 02:54 AM |