Outline View: collapse 'up' to parent heading?

M

michael

Hi,

Word 2003. Outline View.

Let's say I'm in some 'normal' body text under a level 3 heading in an
outline. Is there a simple way (preferably via keyboard shortcut) to collapse
the current block/level I'm in up to the parent heading/level? This would
look like Windows Explorer folder tree, where I can press the left arrow
button to collapse the tree up to the parent folder - very convenient!
Otherwise I have to move or click onto to the parent heading itself and
collapse from there, which is a little tedious when quickly moving around a
doc.

I know I can collapse/expand the whole document to a given level, but that
isn't ideal in many situations for what I'm describing.

Thanks for any thoughts,
Michael
 
S

Stefan Blom

To expand or collapse all paragraphs below a certain heading, double-click
the plus sign next to the relevant heading.

Here are all of the keyboard shortcuts that you can use in Outline view
(from Word Help):

Promote a paragraph. ALT+SHIFT+LEFT ARROW
Demote a paragraph. ALT+SHIFT+RIGHT ARROW
Demote to body text. CTRL+SHIFT+N
Move selected paragraphs up. ALT+SHIFT+UP ARROW
Move selected paragraphs down. ALT+SHIFT+DOWN ARROW
Expand text under a heading. ALT+SHIFT+PLUS SIGN
Collapse text under a heading. ALT+SHIFT+MINUS SIGN
Expand or collapse all text or headings. ALT+SHIFT+A
Hide or display character formatting. The slash (/) key on the numeric keypad
Show the first line of body text or all body text. ALT+SHIFT+L
Show all headings with the Heading 1 style. ALT+SHIFT+1
Show all headings up to Heading n. ALT+SHIFT+n
Insert a tab character. CTRL+TAB
 
M

michael

Thanks. So I'll take this as a "no". Too bad, would be a nice little
additional feature.
 
S

Stefan Blom

I believe Alt+Shift+plus sign (Alt+Shift+minus sign) is the closest you can
get in terms of keyboard shortcuts.
 
M

michael

Yeah, that's what I've been using. I'm just lazy in that I don't want to have
to navigate up to the parent heading's line in order to use the keystroke.
Sometimes, actually, it's not just lazy since subordinate blocks/sections can
be quite long.
 
J

Jeromy

I wrote the following code to do what you're asking for. I use it all
the time. I'm a big fan of Outline View. I hooked the code up to a
keyboard shortcut (control + (minus)). I think it needs some
polishing. It sometimes raises errors. In other words, use it at your
own risk. Perhaps someone can come along and polish it up. Or better
yet this could be implemented as a feature in Microsoft Word.

Sub CIPcollapseHeadings()
On Error GoTo ErrorHandler
Dim r As Range, o As Integer, p As Long, f As Boolean
Set r = Selection.Range
r.End = r.Start + 1 'reduce selection to a single character
o = r.ParagraphFormat.OutlineLevel
If o <> 1 Then
Do Until f = True
With Selection
.MoveUp
If .ParagraphFormat.OutlineLevel < o Then
f = True
End If
End With
Loop
End If
With ActiveWindow
.Activate
.View.Type = wdOutlineView
With .View
.CollapseOutline
.CollapseOutline
.CollapseOutline
End With
End With

Exit Sub
ErrorHandler:
'on error just end
End Sub
 
M

michael

Jeromy, this is *sweet*! Thanks a bunch. It's great to find some who shares
my plite, *and* is a VB programmer.

I've got it in as a macro now with my outline mode template and it's working
fine. I'll post here if I can track any bugs. I'm a programmer, but
C/C++/Matlab, not Visual Basic, but I still might be able to muddle through.

Cheers
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top