none
How Do I Activate the Navigation (Search) Task Pane in a Macro? RRS feed

  • Question

  • I’m using Word 2010 (up-to-date version 14, 32 bit) under Windows 7 (64 bit).  I would like to write a macro to open the word Navigation (search) task pane and “activate” it (so that the insertion point is flashing in the Search Document field).  This can be done manually with the mouse by clicking Home, Find.  But for some reason the macro recorder won’t record that.

    So far, I’ve got the following macro that opens the task pane, but doesn’t activate it:

    Sub DocumentMap()
    ActiveWindow.DocumentMap = True
    xxx

    '  Command attempts that failed:
    '   ActiveDocument.ActiveWindow.Panes(2).Activate
    '   ActiveDocument.ActiveWindow.Panes(0).Activate
    '   ActiveWindow.DocumentMap.SetFocus
    '   CommandBars("Navigation").SetFocus
    '   ActiveWindow.DocumentMap.SetFocus

    End Sub

    Can you suggest what I replace the xxx with to activate the pane?

    Thanks for your help.

    Don Macnaughton



    <object height="1" id="plugin0" style=";z-index:1000;" type="application/x-dgnria" width="1"><param name="tabId" value="{C5016115-A33E-4AA8-B254-B009FD468DE2}" /></object>
    Thursday, October 17, 2013 11:52 PM

Answers

  • Hi Don,

    Thanks for posting in MSDN forum.

    Accoring to your description, you want to active the navigation panel of Word 2010.

    As you metioned you can done it manually by clicking Home, Find. I fond there is a shortcut key Ctrl & F,

    I sugget you try to use SendKeys, below is the code for your reference:

    SendKeys "^f"

    BTW, you couldn't run the code through VBE, it will send keys to active applicaton. So I suggest you to record a empty macro and put the code in the macro.

    You can get more informtaion from aticle below:

    SendKeys Method

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Sunday, October 20, 2013 3:04 AM
    Moderator

All replies

  • Hi Don,

    Thanks for posting in MSDN forum.

    Accoring to your description, you want to active the navigation panel of Word 2010.

    As you metioned you can done it manually by clicking Home, Find. I fond there is a shortcut key Ctrl & F,

    I sugget you try to use SendKeys, below is the code for your reference:

    SendKeys "^f"

    BTW, you couldn't run the code through VBE, it will send keys to active applicaton. So I suggest you to record a empty macro and put the code in the macro.

    You can get more informtaion from aticle below:

    SendKeys Method

    Best regards

    Fei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Sunday, October 20, 2013 3:04 AM
    Moderator
  • Try this macro:

    Sub ShowNavPane()
    Application.TaskPanes(wdTaskPaneNav).Visible = True
    SendKeys "{F6}"
    End Sub

    Note that you can't test the macro from within the Visual Basic Editor, because it requires that focus is in the document window.

    Stefan Blom, Microsoft Word MVP

    Sunday, October 20, 2013 9:21 AM
  • I sugget you try to use SendKeys, below is the code for your reference:

    SendKeys "^f"

    BTW, you couldn't run the code through VBE, it will send keys to active applicaton. So I suggest you to record a empty macro and put the code in the macro.

    You can get more informtaion from aticle below:

    SendKeys Method

    Best regards

    Fei


    Fei,

    Thank you.  That solves the problem.

    Stefan Blom suggests SendKeys "{F6}", which is in principle correct. However, I've reassigned the F6 key to do something else, so SendKeys "^f" is necessary.

    Don

    Monday, October 21, 2013 12:42 AM