![]() |
#1
|
|||
|
|||
![]() Hi to all, unfortunately in Word 2010 Navigation pane is fully expanded whenever I open it. Of course right-clicking in the pane I can set the heading level to whatever level, but the setting (obvioulsy) isn't saved. In 2003 two simple code lines in an _Open macro fixed the problem: Code:
ActiveWindow.View.ShowHeading x ActiveWindow.DocumentMap = True Any ideas how to make the Navigation pane show only the specified heading level? Thanks NP |
#2
|
||||
|
||||
![]()
The code works for me.
.ShowHeading = x, which only works in outline view, displays all headings down to the level specified. .DocumentMap = True displays the document map - which always includes all headings except for the ones you manually hide.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Hi Paul,
You're right, I mixed two things up. But my issue still remains. Working with longer document I often use the Navigation Pane, which - by default - displays all used heading levels. With more than one level displayed it is (for long) documents quite confusing. I still have to scroll and look, scroll and look, ... so I manually reduce the Navigations Panes' appearance to Heading 1 level (right click in the Navigation Pane and 'Reduce all levels' command). But as I use the 'Application.ShowWindowsInTaskbar = False' option, whenever I change documents, the Navigation Pane again uses the default stetting = all heading levels. A very annoying behavior, because then I again have to reduce the number of shown heading levels. My solution right now is a Sendkeys sequence in the 'Document_Change' event. It seems to work reliably but I am not one for Sendkeys solutions. That's why I'm still looking for a 'reduce all levels' (for Naviagtion Pane) command in VBA. Maybe I got a bit stuck in a rut with that command, but I really wasn't able to find a straight VBA way to change the Navigation Pane display behavior. If you can help - great, if there is no solution, I will stick at 'my Sendkeys' until I notice some 'misbehavior'. NP |
#4
|
||||
|
||||
![]()
You might do better to hook into the WindowActivate(ByVal Doc As Document, ByVal Wn As Window) event and run your code against whatever window is active. You should be able to use:
Wn.View.ShowHeading x Wn.DocumentMap = True from there.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
![]()
Sorry no,
it doesn't work. As posted in #1, whatever heading level I select, the code is simply ignored. All heading levels are displayed in Navigation Pane. NP |
#6
|
||||
|
||||
![]()
It works for me. Have you checked that the event is firing?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#7
|
|||
|
|||
![]()
Yes,
I always use msgbox(es) when testing events ![]() Code:
ActiveWindow.View.ShowHeading 1 MsgBox "Event - First Box" ActiveWindow.DocumentMap = True MsgBox "Event - Second Box" I mean, this cannot be some localization bug? I encountered this issue a few times in German forums. Exactly the same => ShowHeading = ignored Strange behavior NP |
#8
|
||||
|
||||
![]()
I suppose it could be a localization bug, but that's not something I can test right now.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#9
|
|||
|
|||
![]()
That's what I also found
Quote:
But why does it work for you and not for me? Your event really changes the displayed heading levels in Navigation Pane? NP |
#10
|
||||
|
||||
![]()
The code works equally well for me using:
Code:
Private Sub wdApp_WindowActivate(ByVal Doc As Document, ByVal Wn As Window) Wn.View.ShowHeading 1 Wn.DocumentMap = True End Sub Code:
Private Sub wdApp_WindowActivate(ByVal Doc As Document, ByVal Wn As Window) Doc.ActiveWindow.View.ShowHeading 1 Doc.ActiveWindow.DocumentMap = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#11
|
|||
|
|||
![]()
It definitely does not. Even if I change to Outline view ...
Code:
Wn.View.Type = wdOutlineView Wn.View.ShowHeading 1 Wn.DocumentMap = True NP |
#12
|
||||
|
||||
![]()
Ah, OK, I've still been thinking in terms of Outline View.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
blazed | Word | 11 | 08-13-2021 05:13 AM |
![]() |
eNGiNe | Word | 14 | 12-14-2016 06:10 PM |
![]() |
taran | Word | 3 | 07-08-2013 01:12 PM |
Navigation Pane | savo | Word | 2 | 04-17-2013 07:14 AM |
Tasks Navigation Pane 2007 | nikainr | Outlook | 0 | 05-30-2011 04:15 AM |