#1
|
|||
|
|||
Word 2013: CollapseHeading with VBA
I am writing a macro that goes through my document and collapses specific sections of the document. The expand/collapse heading is a new feature in Word 2013. I know how to expand or collapse all headings: (ActiveDocument.ActiveWindow.View.ExpandAllHeading s), but I cannot figure out how to only expand/collapse the selected heading. The manual way is to either right-click -> collapse heading. The keyboard shortcut is Alt+Shift+-. I see CollapseHeading listed under macros->Word Commands, but I don't know how to call this command. I tried to step into the CollapseHeading macro, and tried recording a macro collapsing a heading, but neither showed anything. Any ideas? Please help....thanks |
#2
|
|||
|
|||
The following collapse the selected paragraph if it is formatted with a built-in heading style:
Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey If InStr(Selection.Style, "Heading") = 1 Then Selection.Paragraphs(1).CollapsedState = True End If End Sub |
#3
|
|||
|
|||
@GMaxey, Thanks!! It worked!
|
Tags |
vba, word 2013 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Word 2013: Hyperlinks in word created pdf open in web browser and not acrobat reader | slaycock | Word | 5 | 03-08-2014 01:04 PM |
Word 2013 | cday | Word | 4 | 01-16-2014 11:58 AM |
Word 2013 vs Word 2010 formatting issue? | rhoyt | Word | 1 | 12-07-2013 09:40 AM |
Are user customizations transferable from Word 2003 to Word 2010 (2013)? | New Daddy | Word | 3 | 01-14-2013 07:25 AM |
Which ODF/ .odt version is word 2010, 2013 preview & eventually 2013 full using? | semiotically | Word | 8 | 11-08-2012 05:44 PM |