Akki
Akki

Reputation: 1251

Managing Find and Replace dialog box in MS Word 2010 using Macro

The below code display Find and Replace dialog box. But the problem is that the Find tab and the Go To tabs are disabled.
How to keep all the three tabs enabled?

Is it possible to set the Find and Replace combobox Editable property to False?

Public Sub EditReplace()
    On Error Resume Next
    With Dialogs(wdDialogEditReplace)
    Selection.HomeKey Unit:=wdStory
        .Find = "[ ^13^t]{1,};"
        .Replace = ";"
        .Show
    End With
End Sub

Find and Replace dialog box

Upvotes: 3

Views: 1898

Answers (1)

Apps
Apps

Reputation: 61

Try (with the assumption that "Ctrl H" is still a shortcut for "Replace" in the menu):

Public Sub AnotherName()   
       On Error Resume Next
       Selection.HomeKey Unit:=wdStory       
       Selection.Find.Text = "[ ^13^t]{1,};"
       Selection.Find.Replacement.Text = ";"
       SendKeys "+^%H", True
End Sub

The name should rather not be "EditReplace", or you will direct here all replace operations in the future.

Upvotes: 1

Related Questions