Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-08-2013, 08:20 AM
Jennifer Murphy's Avatar
Jennifer Murphy Jennifer Murphy is offline Macro to toggle outline level Windows XP Macro to toggle outline level Office 2007
Competent Performer
Macro to toggle outline level
 
Join Date: Aug 2011
Location: Silicon Valley
Posts: 232
Jennifer Murphy is on a distinguished road
Default Macro to toggle outline level

I'd like to write a macro to toggle the outline level setting. That is, the heading level that is displayed in outline view. The macro would query the current outline level setting and based on that result, do something like this:
  • If the current View setting is "OutlineView", set the Outline Level to "ShowAllHeadings" and set the View to "NormalView".
  • Else set the View to "OutlineView" and the Outline Level to the level of the heading where the cursor is currently positioned. If the cursor is not on a heading, set the Outline Level to "Level 1".
Using the macro recorder, I captured the code to set the View and the Outline Level.
Code:
 
  ActiveWindow.ActivePane.View.Type = wdOutlineView
  ActiveWindow.View.ShowHeading 3
  ActiveWindow.View.ShowHeading 1
  ActiveWindow.View.ShowAllHeadings
  If ActiveWindow.View.SplitSpecial = wdPaneNone Then
    ActiveWindow.ActivePane.View.Type = wdNormalView
  Else
    ActiveWindow.View.Type = wdNormalView
  End If
I don't know how to query the heading level where the cursor is. Can someone help me with that?



Is there any way to get that code using the recorder?

I'd also appreciate any comments or suggestions on this macro.

Thanks
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to toggle outline level Heading level numbering in 2010 - wrong after second header level 1 taran Word 3 07-08-2013 01:12 PM
Changing TOC from 2-level to 3-level SQLUSA Word 6 07-23-2012 06:21 AM
Macro to toggle outline level How to have the words existing in the same Outline Level to be in the Table of Conten Jamal NUMAN Word 1 04-15-2011 06:26 PM
Toggle updates dbugosh Office 2 12-16-2010 07:54 AM
Outline level to Body Text dariober Word 0 08-23-2010 02:54 AM

Other Forums: Access Forums - Senior Forums

All times are GMT -7. The time now is 02:49 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2020 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft