Find/replace behaves differently with Track Changes on

G

gingerpeach123

Some time ago, I recorded a macro to help me remove incorrectly placed
paragraph marks that arise when I paste text from PDF files into Word. (For
example, the phrase "good day" appears as "good[paragraphmark]day" if the
word "good" come at the end of a line; my macro uses find/replace to fix
this.) I just noticed that the macro does not work correctly when I have
Track Changes on.

With Track Changes off, "good[paragraphmark]day" is correctly converted to
"good day."

With Track Changes on, "good[paragraphmark]day" is converted to "goodd ay,"
with the space shifted over from where it should be.

The same thing seems to happen when I use the Find/Replace function
directly, rather than the macro. It also occurs when I type out a new test
document, so it does not seem to be related to the fact that I copied the
text from a .pdf file.

For now I'm OK because I don't absolutely need Track Changes on when I do
the find/replace, but I can imagine that sometime I will want to have it on.
Any idea what is going on?

Thanks!

P.S. I'm running Word 2007 and Vista
 
H

Herb Tyson [MVP]

I'm not seeing that behavior here. Maybe I'm not doing exactly what you're
doing, though. I have:

He had a good[paragraph]
day.

Find what:good^day

Replace with:good day

The resulting change has "good[paragraph]day" with strikethrough, and "good
day" underlined as the correctly inserted text.

--

Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com
 
G

gingerpeach123

Hi, Herb,

Thanks for checking on this. I had used the "good day" text just as an
example; my actual Find/Replace was done using wildcards (specifically, the
find string was "^013([a-z])", to be replaced with " \1").

Since I first started asking around about this problem, several colleagues
have told me that Track Changes and wildcards don't mix; if you want a
Find/Replace with wildcards to run correctly, Track Changes has to be off.

So I have an explanation for the behavior I was seeing, though I'd certainly
prefer it if one could use wildcards to run a search and use Track Changes to
view the results! If you know of a way to accomplish this, please let me know.

Thanks again,

gingerpeach123
================



Herb Tyson said:
I'm not seeing that behavior here. Maybe I'm not doing exactly what you're
doing, though. I have:

He had a good[paragraph]
day.

Find what:good^day

Replace with:good day

The resulting change has "good[paragraph]day" with strikethrough, and "good
day" underlined as the correctly inserted text.

--

Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


gingerpeach123 said:
Some time ago, I recorded a macro to help me remove incorrectly placed
paragraph marks that arise when I paste text from PDF files into Word.
(For
example, the phrase "good day" appears as "good[paragraphmark]day" if the
word "good" come at the end of a line; my macro uses find/replace to fix
this.) I just noticed that the macro does not work correctly when I have
Track Changes on.

With Track Changes off, "good[paragraphmark]day" is correctly converted to
"good day."

With Track Changes on, "good[paragraphmark]day" is converted to "goodd
ay,"
with the space shifted over from where it should be.

The same thing seems to happen when I use the Find/Replace function
directly, rather than the macro. It also occurs when I type out a new test
document, so it does not seem to be related to the fact that I copied the
text from a .pdf file.

For now I'm OK because I don't absolutely need Track Changes on when I do
the find/replace, but I can imagine that sometime I will want to have it
on.
Any idea what is going on?

Thanks!

P.S. I'm running Word 2007 and Vista
 
H

Herb Tyson [MVP]

The following might work:

Find what:^013([a-z]{1,20})(*)(^32)
Replace with:\3\1\2\3

Basically, I expand the search so that it can match any word (all lowercase)
that contains from 1 to 20 letters. I then include a token for anything that
follows (since not all words are immediately followed by a space), and then
a token for the next space that occurs after the word. I then borrow that
found space and use IT rather than an actual space to create the space that
Word seems intent upon putting in the wrong place.

It worked in all scenarios for which I tested it EXCEPT when the found word
has no space after it through the end of the document. Also, if you expect
to have any words longer than 20 characters, change the 20 to something
higher.

--

Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


gingerpeach123 said:
Hi, Herb,

Thanks for checking on this. I had used the "good day" text just as an
example; my actual Find/Replace was done using wildcards (specifically,
the
find string was "^013([a-z])", to be replaced with " \1").

Since I first started asking around about this problem, several colleagues
have told me that Track Changes and wildcards don't mix; if you want a
Find/Replace with wildcards to run correctly, Track Changes has to be off.

So I have an explanation for the behavior I was seeing, though I'd
certainly
prefer it if one could use wildcards to run a search and use Track Changes
to
view the results! If you know of a way to accomplish this, please let me
know.

Thanks again,

gingerpeach123
================



Herb Tyson said:
I'm not seeing that behavior here. Maybe I'm not doing exactly what
you're
doing, though. I have:

He had a good[paragraph]
day.

Find what:good^day

Replace with:good day

The resulting change has "good[paragraph]day" with strikethrough, and
"good
day" underlined as the correctly inserted text.

--

Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


message
Some time ago, I recorded a macro to help me remove incorrectly placed
paragraph marks that arise when I paste text from PDF files into Word.
(For
example, the phrase "good day" appears as "good[paragraphmark]day" if
the
word "good" come at the end of a line; my macro uses find/replace to
fix
this.) I just noticed that the macro does not work correctly when I
have
Track Changes on.

With Track Changes off, "good[paragraphmark]day" is correctly converted
to
"good day."

With Track Changes on, "good[paragraphmark]day" is converted to "goodd
ay,"
with the space shifted over from where it should be.

The same thing seems to happen when I use the Find/Replace function
directly, rather than the macro. It also occurs when I type out a new
test
document, so it does not seem to be related to the fact that I copied
the
text from a .pdf file.

For now I'm OK because I don't absolutely need Track Changes on when I
do
the find/replace, but I can imagine that sometime I will want to have
it
on.
Any idea what is going on?

Thanks!

P.S. I'm running Word 2007 and Vista
 
G

gingerpeach123

Thank you for taking the time to work through this! I'll give it a try.

gingerpeach123

Herb Tyson said:
The following might work:

Find what:^013([a-z]{1,20})(*)(^32)
Replace with:\3\1\2\3

Basically, I expand the search so that it can match any word (all lowercase)
that contains from 1 to 20 letters. I then include a token for anything that
follows (since not all words are immediately followed by a space), and then
a token for the next space that occurs after the word. I then borrow that
found space and use IT rather than an actual space to create the space that
Word seems intent upon putting in the wrong place.

It worked in all scenarios for which I tested it EXCEPT when the found word
has no space after it through the end of the document. Also, if you expect
to have any words longer than 20 characters, change the 20 to something
higher.

--

Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


gingerpeach123 said:
Hi, Herb,

Thanks for checking on this. I had used the "good day" text just as an
example; my actual Find/Replace was done using wildcards (specifically,
the
find string was "^013([a-z])", to be replaced with " \1").

Since I first started asking around about this problem, several colleagues
have told me that Track Changes and wildcards don't mix; if you want a
Find/Replace with wildcards to run correctly, Track Changes has to be off.

So I have an explanation for the behavior I was seeing, though I'd
certainly
prefer it if one could use wildcards to run a search and use Track Changes
to
view the results! If you know of a way to accomplish this, please let me
know.

Thanks again,

gingerpeach123
================



Herb Tyson said:
I'm not seeing that behavior here. Maybe I'm not doing exactly what
you're
doing, though. I have:

He had a good[paragraph]
day.

Find what:good^day

Replace with:good day

The resulting change has "good[paragraph]day" with strikethrough, and
"good
day" underlined as the correctly inserted text.

--

Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


message
Some time ago, I recorded a macro to help me remove incorrectly placed
paragraph marks that arise when I paste text from PDF files into Word.
(For
example, the phrase "good day" appears as "good[paragraphmark]day" if
the
word "good" come at the end of a line; my macro uses find/replace to
fix
this.) I just noticed that the macro does not work correctly when I
have
Track Changes on.

With Track Changes off, "good[paragraphmark]day" is correctly converted
to
"good day."

With Track Changes on, "good[paragraphmark]day" is converted to "goodd
ay,"
with the space shifted over from where it should be.

The same thing seems to happen when I use the Find/Replace function
directly, rather than the macro. It also occurs when I type out a new
test
document, so it does not seem to be related to the fact that I copied
the
text from a .pdf file.

For now I'm OK because I don't absolutely need Track Changes on when I
do
the find/replace, but I can imagine that sometime I will want to have
it
on.
Any idea what is going on?

Thanks!

P.S. I'm running Word 2007 and Vista
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top