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. #2
    VBAX Regular
    Joined
    Mar 2020
    Posts
    79
    Location
    Private Sub CommandButton48CopyTextInTextbox_Click()
        If selection.Type = wdSelectionIP Then InSelection = True
        selection.HomeKey wdStory
        TextBox8refList.SetFocus
        SendKeys "{Home}"
        SendKeys "+{End}"
        DoEvents 'This was the key to this working. Macro was going ahead of itself
        TextBox8refList.SetFocus
        TextBox8refList.Copy
        Dim DataObj As MSForms.DataObject
        Set DataObj = New MSForms.DataObject
        DataObj.GetFromClipboard
        strPaste = DataObj.GetText(1)
        Dim dlg As Dialog
        Set dlg = Application.Dialogs(wdDialogEditFind)
        dlg.Find = strPaste
        SendKeys "%(f){tab}{ENTER}"
        dlg.Show
        ' This section added, and it makes it use the navigation window
        If CheckBox17NavigationPane.Value = True Then
            SendKeys "^f"
            SendKeys "^v"
            SendKeys "{ENTER}"
        End If
    End Sub
    Well after much trial and error I found this works and with the checkbox option I can have it use either the regular search box or the navigation pane.
    Last edited by Aussiebear; 01-04-2025 at 02:57 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
  •