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. #4
    VBAX Regular
    Joined
    Mar 2020
    Posts
    79
    Location
    Rolled back to this and it works.

    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
        ' On Error Resume Next
        ' ActiveWindow.SetFocus
        ' DoEvents
        If CheckBox17NavigationPane.Value = True Then
             SendKeys "^f"
             SendKeys "^v"
             SendKeys "{ENTER}"
        End If
    End Sub
    Last edited by Aussiebear; 01-04-2025 at 03:04 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
  •