macro asking for word to find/replace

A

abelp1975

Hello you all:


I need to create a macro da fits some particular questions while
running.
I wonder if it's possible to create an action where I ask part of the
find word? Something like:


"find for: "XXXX" & ^#^#" where XXXXX is the field and it's any word
and the ^#^# any two digits. Something like this "myparents01". After
inserting the word the macro would continue to do the find/replace
action and the next actions too.


Thank you once again for your good help.


Abel.
 
G

Greg

Do you remeber that macro I posted for you about your Uncle Bob?

Modify as follows.

Add:
dim oFindWord as String
oFindWord = InputBox("Type the word you want to fine")

Change

..Text = "Bob's your uncle"
to
..Text = oFindWord

Bob's still your uncle ;-)
 
A

abelp1975

Dear Greg:
Thank you for all your concern and help here.

For all of you which may be interested here goes the final code:
Sub Potatoes()
Dim oFindWord As String
oFindWord = InputBox("Type the word you want to fine")
With Selection.Find
.Text = oFindWord
.Replacement.Text = "favorit sista"
.Execute Replace:=wdReplaceAll
End With
End Sub

Abel
 
G

Greg

Before you make it final, you might want to change
"Type the word you want to fine" to "Type the word you want to find"

In case you aren't sure about the replacement (maybe it isn't your
favorite sista after all) you might add:

Dim oReplaceWord As String
oReplaceWord = InputBox("Type the word replacement word or phrase")

Change
..Replacement.Text = "favorit sista" to
..Replacement.Text = oReplaceWord

Good luck with all them favorite relatives.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top