PDA

View Full Version : Solved: AutoText Find - Help Required



markh1182
06-22-2007, 01:56 AM
Hi,

I have an AutoText box with text in (obviously) and when I record a macro to find a phrase within that text it finds it ok. However, when I try to use this macro within another area it does not find the text.

What am I missing?

This is the code that was recorded:
Sub FindWords()
Selection.Find.ClearFormatting
With Selection.Find
.Text = "Law Society"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
Selection.Find.Execute
End Sub

lucas
06-22-2007, 08:12 AM
Not sure but my question would be....what is selected...

you code is using a selection: With Selection

fumei
06-25-2007, 10:53 AM
Yes, please clarify...
when I try to use this macro within another area it does not find the textMy emphasis.

Unless the box is selected, your code will not work.

Also, I am not sure what is the relevance of AutoText. If I understand correctly ( and of course I may be) you have an AutoText entry that is putting a textbox into the document? And you are searching in the textbox???

markh1182
06-26-2007, 01:24 AM
I've fixed my query on this one. Thanks anyway.