Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Menus and Toolbars / February 2004

Tip: Looking for answers? Try searching our database.

edit-replace function

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lewis Shanks - 24 Feb 2004 05:50 GMT
Is there a way where I can edit or replace text as follows:

Current version of text: "123-345-6789 fax:"

I want to change this to "fax: 123-345-6789"

These numbers will be in a large list, so I want to be able to do this, if
possible, for all at the same time.

Lewis Shanks
Suzanne S. Barnhill - 24 Feb 2004 05:56 GMT
See http://word.mvps.org/FAQs/General/UsingWildcards.htm

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Signature

Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


> Is there a way where I can edit or replace text as follows:
>
[quoted text clipped - 6 lines]
>
> Lewis Shanks
Graham Mayor - 24 Feb 2004 06:43 GMT
Wildcard replace
([0-9\-]{12}) (fax:)
with
\2 \1

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
    Graham Mayor -  Word MVP

     Web site www.gmayor.com
 Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>

> Is there a way where I can edit or replace text as follows:
>
[quoted text clipped - 6 lines]
>
> Lewis Shanks
Suzanne S. Barnhill - 24 Feb 2004 15:39 GMT
It will need to be a bit different from that, as I believe the "Find what"
text doesn't include the colon after "fax." This could probably be added in
a separate second run, though.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Signature

Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


> Wildcard replace
> ([0-9\-]{12}) (fax:)
[quoted text clipped - 19 lines]
> >
> > Lewis Shanks
Graham Mayor - 24 Feb 2004 16:02 GMT
It works as written using the example provided which has a colon after fax
in both samples.
The search string has a colon also ie ([0-9\-]{12}) (fax:)
If one or other colon was not required it wouldn't be difficult to adjust
the search and replace strings.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
    Graham Mayor -  Word MVP

     Web site www.gmayor.com
 Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>

> It will need to be a bit different from that, as I believe the "Find
> what" text doesn't include the colon after "fax." This could probably
[quoted text clipped - 23 lines]
>>>
>>> Lewis Shanks
Lewis Shanks - 24 Feb 2004 17:20 GMT
Graham/Suzanne:
I tried to use the replace function as noted but ended up with no "hits" or
replacements.

Here is a partial list of the type of name list I have where I wish to make
this change. Is it possible to give me a little more info/advice?  FYI,
originally the list has "fx:" instead of "fax:". I replaced this easily
enough, but am stuck on moving the "fax:" to the front of the number.
Thanks very much
Lewis

     A&M Aquatics
     16260 National Pkwy
     Lansing, MI  48906
    Bill Backus
     517-321-7258  ph
     517-703-9688  fax:
     Bill@amaquatics.com
     www.amaquatics.com

     Alpine Marine Imports
     P.O. Box 1718
     Orem UT  84059
    John Johnson
     801-221-0904  ph
     801-221-0949  fax:
     connie_johnson@juno.com

     Amblard Overseas Trading
     20 Avenue De La Chevali?re
     Mazamet, France F-81200
    Fr?d?ric Amblard
     (33)563982009 ph
     (33)563612491 fax:
     info@amblard.fr
     www.amblard.fr

     Aqua Craft Inc
     P.O. Box 653
     San Carlos CA  94070
    Michael Del Prete
     650-637-0322  ph
     650-637-0476  fax:
     aquacraft1@aol.com
     www.aquacraft.net

> It works as written using the example provided which has a colon after fax
> in both samples.
[quoted text clipped - 29 lines]
> >>>
> >>> Lewis Shanks
Jon Weaver - 24 Feb 2004 17:46 GMT
It works exactly as Graham Mayor wrote for the specific pattern you
requested.

In the Find what box, make sure there is a space before "(fax:)" and that
there are no other spaces in the box; also make sure you have used the
correct form of bracket -- square [], curly {} and rounded or parentheses ()

Also make sure you have clicked More and checked the Use wildcards check
box; if this check box is not checked, Word will find and replace nothing

Good luck!

Jon
Lewis Shanks - 24 Feb 2004 19:37 GMT
Jon:
I'm really feeling stupid here!

The wildcards check box was/is checked per what the "Finding and Replacing
characters using wildcards" site suggests.
In the same para which says to check this box, it further says "in a macro,
set.Find.MatchWildcards = True." If you do not do this, Word treats the
wildcard characters as if they were ordinary text." I have no idea how to do
this! I went to Macros and got lost immediately.

Same as before, after making sure that the find box details are correctly
typed and the replace with box has \2 \1 in it, I again try to replace all
and end up with no results.

Is there any way that I might be able to call you to discuss further?

Lewis

> It works exactly as Graham Mayor wrote for the specific pattern you
> requested.
[quoted text clipped - 9 lines]
>
> Jon
Jon Weaver - 24 Feb 2004 20:36 GMT
Lewis,
Let's start all over again. To make the change for all phone numbers
formatted as "123-345-6789 fax:" to "fax: 123-345-6789" in a single Word
document (or in one Word document at a time), you do not need to use macros.

Simply perform the following steps:
1. Open the Word document containing information you want to change
2. On the Edit menu, click Replace
3. Click More to reveal more options in the dialog box (if the Less button
is already highlighted you're OK)
4. Click the Use wildcards check box under Search Options so that it
contains a check mark; make sure the other check boxes immediately below are
cleared/not checked
5.  In the Find what box, type ([0-9\-]{12}) (fax:)
    a. Note the space before (fax:); do not include any other spaces in the
Find what box
    b. Make sure you have used the correct form of bracket -- square [],
curly {} and rounded or parentheses ()
6.  In the Replace with box, type \2 \1
    a. make sure there is no space before \2
7.  Click Replace All
Note:  Make sure there is no formatting specified in either the Find what or
Replace with boxes.  If formatting has been specified in the Find what box,
with the insertion point in the Find what box, click No Formatting; if
formatting has been specified in the Replace with box, with the insertion
point in the Replace with box, click No Formatting.

This will handle phone numbers in the 1st pattern you specified.

Good luck!

Jon
Jon Weaver - 24 Feb 2004 21:05 GMT
Lewis,

2 other possible sources of your problem:
1. in 0-9, the 0 is a number, not a letter
2. wildcard searches are case sensitive; make sure you have the right case
for each the letters in "fax" -- if the document contains "fax" and you
search for "Fax", you won't find anything.

Jon
Graham Mayor - 25 Feb 2004 05:36 GMT
Jon seems to have the measure of this - but there are two issues why the
search pattern may not be finding the string
1. There are two spaces between the number and fax - not one as shown in the
original search string (and if you paste the string from your message into
Word, one of those spaces is a non-breaking space. You can check in the
original document by viewing the space characters with CTRL+* a space will
be seen as a dot a non breaking space as a small circle. Change the search
pattern to reflect that.
ie
([0-9\-]{12}) ^s(fax:) - where ^s is the non breaking space.

The search really is quite simple and the details of how to use wildcard
searches can be found in the article in the link that Suzanne posted

Here, you have two round bracketed sections. The brackets are there only to
identify the sections. They are not part of the search itself.
The bit in the first set of square brackets [0-9\-]  tells Word to look for
any numeral or hyphen. Because hyphen is a reserved character the \ tells
Word to treat it as a character to search. This Word should look for any
numeral or hyphen. The {12} tells Word to look for a sequence of 12 such
characters. That completes the first section. Next are the spaces and
finally the bracketed fax text. We use the brackets because we want to use
the content in the replace string.

The \2 \1 tells Word to replace with the second bracketed bit followed by a
space then the first bracketed bit.

Adjust the strings to reflect *exactly* what you have and want.

If, as I read somewhere, you want to replace fax: with fx: or vice versa,
you don't need the second bracketed bit. You type exactly what you want in
the replacement eg.

([0-9\-]{12}) fx:
fax: \1

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
    Graham Mayor -  Word MVP

     Web site www.gmayor.com
 Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>

> Jon:
> I'm really feeling stupid here!
[quoted text clipped - 29 lines]
>>
>> Jon
Suzanne S. Barnhill - 25 Feb 2004 15:01 GMT
The original text (unless it's HTML-derived) may not actually have a
nonbreaking space; some converters (such as FP) convert extra spaces into
nonbreaking spaces because native HTML reduces all white space (except
nonbreaking spaces) to a single space.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Signature

Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


> Jon seems to have the measure of this - but there are two issues why the
> search pattern may not be finding the string
[quoted text clipped - 73 lines]
> >>
> >> Jon
Lewis Shanks - 25 Feb 2004 19:31 GMT
Thanks to all for your hard efforts here. I'm still stuck.

Here is what I did:
First: what I ultimately need is for the "fax:" to be in front of the
number. I use Address or List Grabber to then grab the complete list to move
it to a data base. These programs will not recognize the fax nr. unless the
original data is set up as "Fax:"  or "fax:" (no need for caps).  The lists
that I find are often in a format where the fax nr. is listed as "f" or "fx"
or something like that. When it is in front of the number, it's easy to
simply do a replacement, but in some cases like this one I find it at the
end of the number.

Here is exactly what I did:
At this web site: http://amdareef.com/, I highlighted the first few
companies listed as the example I advised you of. I transferred this to a
Word document. I deleted the columns in the table to the right of the
phone/fax nrs., converted the format from table to text, put a space between
each company, and replaced "fx" with "Fax:" to arrive at the following:
(note: I also made sure that there were two spaces between the nr. and
"fax", since one of them had only one space).

A&M Aquatics
16260 National Pkwy
Lansing, MI  48906

Bill Backus
517-321-7258  ph
517-703-9688  fax:
Bill@amaquatics.com
www.amaquatics.com

Alpine Marine Imports
P.O. Box 1718
Orem UT  84059

John Johnson
801-221-0904  ph
801-221-0949  fax:
connie_johnson@juno.com

Amblard Overseas Trading
20 Avenue De La Chevali?re
Mazamet, France F-81200

Fr?d?ric Amblard
(33)563982009 ph
(33)563612491 fax:
info@amblard.fr
www.amblard.fr

Aqua Craft Inc
P.O. Box 653
San Carlos CA  94070

Michael Del Prete
650-637-0322  ph
650-637-0476  fax:
aquacraft1@aol.com
www.aquacraft.net

Aquaman's Reef
85 Wales Ave
Jersey City, NJ 07306

Joseph DiTommaso
201-209-9242 ph
201-209-0974  fax:
service@aquamansreef.com
www.aquamansreef.com

Aquarium Center
2458 N 4th Street
Flagstaff AZ  86004

Nick Lydon
928-526-1469  ph
928-526-7029  fax:
aquactr@mindspring.com

I have now tried all recent suggestions, including the non breaking space
approach to make sure that there were two spaces in all cases.

Still, the result if no success at all when I try to replace it.  I
understand if you give up on me, but thought that I would try once again
since all of you have spent so much time on this for me.

Thanks
Lewis Shanks
> The original text (unless it's HTML-derived) may not actually have a
> nonbreaking space; some converters (such as FP) convert extra spaces into
[quoted text clipped - 91 lines]
> > >>
> > >> Jon
Jon Weaver - 25 Feb 2004 21:35 GMT
Lewis,
I did exactly what you said you had done assuming that you used the Paste
command on the Edit menu to "transfer" the text to a Word document.

The problems with what we've been trying to do are now clear:
1.  Between the last digit of the fax numbers there is a non-breaking space
followed by a space; Graham Mayor has already suggested using ^s (the ^ is
SHIFT+6) to represent the non-breaking space
2. After the word fx there is a line break formatting mark; this must be
included in the Find what box;

Now do the following:
1. Click the Show/Hide button on the Standard toolbar; you should now see
the relevant formatting marks (non-breaking space, the space and the line
break--a twisted left-pointing arrow)
2. Assuming you've replaced fx with fax:, put the following in the Find what
box:
([0-9\-]{12})^s (fax:)^l
Note that the ^s is followed by a space, not followed by a space; the ^l
code (the lowercase letter L) represents a line break and is not preceded or
followed by a space
3.  In the Replace with box, put the following:
\2 \1^13
Note the space between \2 and \1 and the addition of ^13 (the digits 1 and
3), which represents a paragraph mark; if you didn't include ^13, the fax
number text will run into the following e-mail address; make sure there is
no space before the ^l

I tried this and it works.

If it does not work in any particular cases, look carefully at the
formatting marks and change your search accordingly.

Good luck!!!

Jon
Graham Mayor - 26 Feb 2004 04:26 GMT
And if that doesn't fix it for you, send me a copy of the document you are
working on.

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
    Graham Mayor -  Word MVP

     Web site www.gmayor.com
 Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>

> Lewis,
> I did exactly what you said you had done assuming that you used the
[quoted text clipped - 33 lines]
>
> Jon
Suzanne S. Barnhill - 25 Feb 2004 02:50 GMT
Sorry, Graham, I didn't see the colon in his "Find what" text in the
original method, but you're right, of course.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Signature

Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://www.word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.


> It works as written using the example provided which has a colon after fax
> in both samples.
[quoted text clipped - 37 lines]
> >>>
> >>> Lewis Shanks
Graham Mayor - 25 Feb 2004 05:36 GMT
The eyes are the first to go <bg>

Signature

<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
    Graham Mayor -  Word MVP

     Web site www.gmayor.com
 Word MVP web site www.mvps.org/word
<>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>

> Sorry, Graham, I didn't see the colon in his "Find what" text in the
> original method, but you're right, of course.
[quoted text clipped - 40 lines]
>>>>>
>>>>> Lewis Shanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.