When I use Ctrl+F my selected text is put into the find side panel, but I need to do extra mouse steps to do a replace.
When I do Ctrl+H I get a replace dialog box, but it ignores my selected text.
Is there a way to have a keyboard shortcut that opens a replace box directly, putting selected text into the find field?
2 Answers 2
You can press Ctrl+C, Ctrl+H, Ctrl+V to get your desired effect, but if even that's too much then you can make a macro to do it all in one go.
Perhaps map it to the unused Ctrl+Alt+H key combination.
Sub QuickReplace()
Selection.Copy
Dim DataObj As MSForms.DataObject
Set DataObj = New MSForms.DataObject
DataObj.GetFromClipboard
Selection.Find.Text = DataObj.GetText
Dialogs(wdDialogEditReplace).Show
End Sub
If you receive a "User-defined type not defined" you are missing the reference to Microsoft Forms 2.0 Object Library. If its not listed, add C:\Windows\System32\FM20.dll or C:\Windows\FM20.dll as a reference.
Is there a way to have a keyboard shortcut that opens a replace box directly, putting selected text into the find field?
That's the default behaviour with Word 2013 when you hit Ctrl+H.
Perhaps this is of interest to you even though you explicitly mentioned Word 2010.
-
Is there a way to set this as the default behavior in Word 2010?Mark Kosmowski– Mark Kosmowski2016年05月07日 02:41:45 +00:00Commented May 7, 2016 at 2:41
-
@MarkKosmowski: Not that I know of.Lernkurve– Lernkurve2016年05月07日 08:30:36 +00:00Commented May 7, 2016 at 8:30
-
@MarkKosmowski Didn't the macro solution work for you? Another solution would be to install AutoHotkey and to write a script which would intercept Ctrl+H and do what you want. I could try writing a script if that was a viable solution and see whether it works at all.Lernkurve– Lernkurve2016年05月07日 08:33:56 +00:00Commented May 7, 2016 at 8:33