Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 06-29-2017, 11:04 AM
jennybt jennybt is offline Navigation Pane Windows 7 64bit Navigation Pane Office 2013
Novice
Navigation Pane
 
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
  #2  
Old 07-12-2017, 04:31 AM
slaycock slaycock is offline Navigation Pane Windows 7 64bit Navigation Pane Office 2013
Expert
 
Join Date: Sep 2013
Posts: 256
slaycock is on a distinguished road
Default

What are you trying to achieve with this code. Specifically why are you searching for comments using the navigation pane when you can easily access the comments collection as

Activedocument.comments
Reply With Quote
Reply

Tags
navigation pane, vba macro, vba word



Similar Threads
Thread Thread Starter Forum Replies Last Post
Navigation pane BeverlyB Word 1 09-29-2014 12:10 PM
Navigation pane BeverlyB Word 2 09-18-2014 12:01 PM
Navigation Pane Navigation Pane windseaker Word 2 04-25-2014 10:34 AM
Navigation Pane savo Word 2 04-17-2013 07:14 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:22 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft