View Single Post
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Wildcard problem

Depending upon what else is in the document you could search for
MY GRACE *way.com

see http://www.gmayor.com/replace_using_wildcards.htm

or you could use a macro

Dim sFindText As String
Dim r As Range
Dim i As Long
sFindText = "MY GRACE IS SUFFICIENT"
Set r = ActiveDocument.Range
With r.Find
Do While .Execute(findText:=sFindText, Forward:=True) = True
r.End = r.Paragraphs(1).Range.End
r.MoveEnd wdWord, 21
If r.Characters.Last = Chr(32) Then
r.End = r.End - 1
End If
'Do what you want with the found text - r - here e.g.
MsgBox r
r.Collapse wdCollapseEnd
Loop
End With


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




"Paul B." wrote in message
...
I'm almost there on a search expression, but the last step is
confounding me. Here's what I'm looking for:

MY GRACE IS SUFFICIENT FOR YOU 9/47
All Rights Reserved - The Good Way Publishing - 2010
http://www.the-good-way.com

This expression:
MY GRACE[a-zA-Z0-9/ ^13\-:.]{11,122}

Finds this:

MY GRACE IS SUFFICIENT FOR YOU 9/47
All Rights Reserved - The Good Way Publishing - 2010
http://www.the-good-way.com
of person he

So I thought this would be easy to resolve by adding "com" to the end
of my expression:
MY GRACE[a-zA-Z0-9/ ^13\-:.]{11,122}.com

thus limiting the find at that point. But that expression is not found
at all, which totally stumps me. I would appreciate any insight into
this.
I'm in Word 03 on Windows XP.

Thanks,
p.