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
|