Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Try this find on this doc (97SR2)

    Dear Friends both near and far,

    As many of you know, I've been working on a Word Find using Selection.find to find USA addresses in documents. (I'm not ready just yet to explore the use of VBA "Like" or, as Klaus suggests, the VBScript object RegExtTest.) The requirements (ideally) would account for addresses in tables, fields and regular body text. (In line addresses are still a problem, but rare.)

    Here's the syntax I've got so far (with thanks to Klaus for some helpful insights!):

    Findtext:="[A-Z][a-z]@,[ ][A-W][A-Z a-z]@[ ]{1,3}[0-9-]{5,10}"

    What gets me is that I've got a city name in a field (and only the city name -- no state or zip) and the find operation "finds" that city name even though the field text DOES NOT match the criteria of the above search. Oddly enough, when the search engine finds the city field, it does not select it like it does on the other finds (there is nothing visible to indicate anything is selected --not even the IP!!!). If you force the selection with

    selection.bookmarks("Sel").select

    it gets visibly selected. Go figure.

    Do me a favor, por favor? Run a Find on the attached doc using the search criteria above and report back your results on the field codes. Thanks mucho. Please indicate your Word version. I'm anxiously awaiting your post...
    Attached Files Attached Files
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. Subscribe to our Windows Secrets Newsletter - It's Free!

    Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Lounger
    Join Date
    Aug 2001
    Location
    Perth,(aka middle of nowhere), Western Australia, Australia
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Try this find on this doc (97SR2)

    Kevin,
    the [A-W][A-Z a-z]@ seems odd to me.
    This is supposed to be the CA, CO or AZ etc part is it not?
    I know ranges in wildcard finds are directional so is lowercase precedent over upper case?
    When I run the test I get similar results to you but the field containing "Sacramento, CA 95814-4174" in the Proof of Service section is the 5th successful find and is highlighted but not returnable as selection.text.
    The first 2 find hits in the Robert A. Levy address and board address are highlighted and returned with selection.text, find hits 3 & 4 are in the Proof of service section but not highlighted or returned with selection.text, hit 5 is as noted above hit 6 is last line of second paragraph (not highlighted not available through selection.text) hit 7 is "Diego, CA 92101" and is highlighted, hit 8 is in last line of doc "...executed on ..." but not highlighted and not returned via selection.text.

    Hope this feedback is useful (Word97SR2).

    Regards
    Dansy

  4. #3
    5 Star Lounger
    Join Date
    May 2001
    Location
    Stuttgart, Baden-W, Germany
    Posts
    931
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Try this find on this doc (97SR2)

    I get about the same results in Word2000 (Win98).

    Doing a "Replace all", there is no problem (4 replacements, including the text that is a field result).

    As far as I can tell, Word starts matching the text that results from fields, and aborts the search if no match occurs. No text is selected, so no false matches are reported. But it's still a nuisance that the search stops.

    When working with Graham Mayor on the <A target="_blank" HREF=http://www.mvps.org/word/FAQs/General/UsingWildcards.htm>wildcard article at mvps.org/word</A>, I stumbled across other oddities with fields, for example in your file, the sentence "... I served the DISMISSAL LETTER regarding ..." (DISMISSAL LETTER is a field result).
    Find what: "served the * regarding" won't match (!?!), "served the* regarding" will match.
    With field-codes displayed, " DOCVARIABLE" will match, "? DOCVARIABLE" won't.

    It's probably a hard job to program the "Find/Replace" so it works with normal text and field results, and the MS programmers left some rough edges ...

    <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>Regards, Klaus

  5. #4
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Try this find on this doc (97SR2)

    David,

    Thank you for your time on this. Your results are *identical* to mine. So, you are confirming the problematic nature of the wildcard search. Now I have a workaround which I'll post, but I still think there is something weird here.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  6. #5
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Try this find on this doc (97SR2)

    Klaus,

    Thanks for confirming the "rough edges". This, then, is another case of inconsistent behavior in Word, but consistent behavior at MS.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •