Thread: Navigation Pane
View Single Post
 
Old 06-29-2017, 11:04 AM
jennybt jennybt is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jun 2017
Posts: 1
jennybt is on a distinguished road
Default Navigation Pane

Hello,

I am trying to automate the navigation pane to automatically search for comments when you open a document. My code works (as in it searches for the comments) but shows no results. The document I test it on has multiple comments and if I do this action manually, the navigation pane displays all the comments, as it should. The macro works when opening a document and searches for comments, but does not display results. Any help is appreciated! Code below (please note I have tried both creating a new module and word object for this). I have also tried different macros, SendKeys is my last resort, but if anyone knows of a better macro, please let me know!

Private Sub Document_Open()

ActiveWindow.DocumentMap = True

' Activate/Deactivate Navigation Pane
' Collapse All, to only show heading level 1
Set myRange = ActiveDocument.Content
ActiveWindow.DocumentMap = True

If ActiveWindow.DocumentMap = True Then

' Ctrl-F = Find --> this sets the cursor at the top of the navigation pane
' ^ = Ctrl key
' + = Shift key
SendKeys "^(f){TAB}{ENTER}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TA B}{TAB}{TAB}{ENTER}{DOWN}{ENTER}"

End If
ActiveWindow.View.ShowComments = True


End Sub
Reply With Quote