View Single Post
  #7   Report Post  
Posted to microsoft.public.word.docmanagement
Peter T. Daniels Peter T. Daniels is offline
external usenet poster
 
Posts: 3,215
Default find and replace with logic

Precisely. The problem you set was to interchange two words, and the
only way to do this is to go through a third word (which does not
appear in the final product). Mr. Maxey did it with a macro, and I did
it in a way that shows you how the macro works.

If you have to exchange three words, you need to use four words in the
process, and so on.

(It's like the "Towers of Hanoi" puzzle, where you need to move a
stack of different size discs from one post to another -- you need a
third post for them to "rest" on while you are carrying out the
moves.)

On Sep 21, 6:51*am, "Greg Maxey"
wrote:
I believe Mr. Daniels intended for you to start with two paired words:

Jane has a book and a pen. *Sally has a book and a pen.

Using ReplaceAll replace book with pencil. *Then first intermediate result
is:

Jane has a pencil and a pen. *Sally has a pencil and a pen.

Using ReplaceAll replace pen with book. *The sencond intermediate result is:

Jane has a pencil and a book. *Sally has a pencil and a book.

Using ReplaceAll replace pencil with pen. *The final result is:

Jane has a pen and a book. *Sally has a pen and a book.

The words pen and book have been interchanged.





viensdansmavie wrote:
))
Change location=book and pen but Book and pen will always appear in
text. I understand question thus and we must use "replace all"
function
Auxiliary word: pencil
I tried your answer I wrote 3 words first
book
pencil
pen
and *I "replaced all" book with pencil now there is pencil, pencil
and pen. Book became invisible in text. Auxiliary word can invisible
only.
I try this for 3 days. What strange question or I understand wrong
everything


"Peter T. Daniels" wrote:


Another way is with a three-step Replace process (which is what your
teacher seems to have in mind). Replace "book" with "pencil." Replace
"pen" with "book." Replace "pencil" with "pen."


Unfortunately it looks like you've gotten both Greg and me to do your
homework for you.


On Sep 20, 9:39 pm, viensdansmavie
wrote:
anybody know the answer this question?
Words "book" and "pen" word has changed location, change the
location on these two by using a function in the program (Microsoft
Word) without losing any of the words. What is important is to
understand how to do this.
Hint:
You can use logic and function. (Function: replace all)
t.ex
Take a box a apple and a melon.


put apple and melon on the table.


If you replace the apple with a new melon.


And then replace the melons with apples.


So You've no melons left. This is what happens when you run the
function replace all.


Now you can with the help of box do anything crafty so we have both
apple and melon still make the switch locations. But thus need to
do things in more than two steps. (three steps)


--
Greg Maxey

See my web sitehttp://gregmaxey.mvps.org
for an eclectic collection of Word Tips.

"It is not the critic who counts, not the man who points out how the
strong man stumbles, or where the doer of deeds could have done them
better. The credit belongs to the man in the arena, whose face is
marred by dust and sweat and blood, who strives valiantly...who knows
the great enthusiasms, the great devotions, who spends himself in a
worthy cause, who at the best knows in the end the triumph of high
achievement, and who at the worst, if he fails, at least fails while
daring greatly, so that his place shall never be with those cold and
timid souls who have never known neither victory nor defeat." - *TR-