Results 1 to 5 of 5

Thread: Paste to navigation search box from userform

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Regular
    Joined
    Mar 2020
    Posts
    79
    Location

    Paste to navigation search box from userform

    I am using a form in a VBA macro in Word.

    In Word 2010 there is a navigation pane.
    At the top you can type something to search.

    I want to paste data I have in the clipboard to that navigation pane search box.
    I can't seem to activate that navigation search box with what I have tried.

    So my form lists out the result of a regex search into a textbox. I triple click to select the line I want to now locate in the Word document and press a button on my form.
    The msgbox shows with the correct data, so that is good so far.
    It is just the next step that I need. (I have commented out the SendKeys part). How to select that search box and then I can use the SendKeys part of the code.

    Private Sub CommandButton48CopyTextInTextbox_Click()
        TextBox8refList.SetFocus
        TextBox8refList.Copy
        Dim DataObj As MSForms.DataObject
        Set DataObj = New MSForms.DataObject
        DataObj.GetFromClipboard
        strPaste = DataObj.GetText(1)
        ActiveWindow.DocumentMap = True
        ActiveWindow.SetFocus
        ActiveDocument.Activate
        'SendKeys "^(f){backspace}^{v}{Enter}"
        MsgBox (strPaste)
    End Sub
    thanks in advance for any assistance.
    Jon
    Last edited by Aussiebear; 01-04-2025 at 02:55 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •