I'm trying to write a macro that finds & replaces several things all in one
batch. Track changes needs to be on.

The problem is that the "finds" also see and act on deleted text. How can I
run a find and replace that ignores the deleted text? I know this was a
problem in Word 97 because I found a KB article on it. Surely they fixed it
by now?

I have tried limiting finds for black text or font style normal...that
doesn't work.

Re: Word 2003 Find/Replace Doesn't Ignore Deleted Text by Russ

Russ
Sat Sep 09 12:59:26 CDT 2006

John,

> I'm trying to write a macro that finds & replaces several things all in one
> batch. Track changes needs to be on.
>
> The problem is that the "finds" also see and act on deleted text.

A little bit of semantics here ;-)
The text is still there and only "marked" for deletion by an overlay with
actual deletion pending until deletion change is accepted. That's why the
find function still sees it. If you select a piece of "marked" text and
bring up the font format dialog box, you'll see that the font format still
shows it as it was before being marked for deletion. It's like the dialog
box is not aware of the other "dimensional" marking overlay. The find dialog
box must not see it either.

> How can I
> run a find and replace that ignores the deleted text? I know this was a
> problem in Word 97 because I found a KB article on it. Surely they fixed it
> by now?
>
> I have tried limiting finds for black text or font style normal...that
> doesn't work.

--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID


Re: Word 2003 Find/Replace Doesn't Ignore Deleted Text by Tony

Tony
Sat Sep 09 14:37:24 CDT 2006

To make F&R ignore deleted text you need to make it hidden, something like
this ...

Dim DeletedTextOption As WdDeletedTextMark

' Save the current user setting
DeletedTextOption = Options.DeletedTextMark
' Override it with Hidden
Options.DeletedTextMark = wdDeletedTextMarkHidden
' Make sure hidden text is not looked at
ActiveDocument.Range.TextRetrievalMode.IncludeHiddenText = False

' Do your Replace here

' Reset to user's option, saved above
Options.DeletedTextMark = DeletedTextOption

--
Enjoy,
Tony

"John Sharp" <John Sharp@discussions.microsoft.com> wrote in message
news:1E62BE27-BE4C-44E6-90DC-508466E7AE83@microsoft.com...
> I'm trying to write a macro that finds & replaces several things all in
one
> batch. Track changes needs to be on.
>
> The problem is that the "finds" also see and act on deleted text. How can
I
> run a find and replace that ignores the deleted text? I know this was a
> problem in Word 97 because I found a KB article on it. Surely they fixed
it
> by now?
>
> I have tried limiting finds for black text or font style normal...that
> doesn't work.



Re: Word 2003 Find/Replace Doesn't Ignore Deleted Text by Russ

Russ
Sat Sep 09 16:18:18 CDT 2006






> To make F&R ignore deleted text you need to make it hidden, something like
> this ...
>
> Dim DeletedTextOption As WdDeletedTextMark
>
> ' Save the current user setting
> DeletedTextOption = Options.DeletedTextMark
> ' Override it with Hidden
> Options.DeletedTextMark = wdDeletedTextMarkHidden
> ' Make sure hidden text is not looked at
> ActiveDocument.Range.TextRetrievalMode.IncludeHiddenText = False
>
> ' Do your Replace here
Also an important distinction is that Selection.Find does not seem to work
with TextRetrievalMode.
You must use Range.Find. Something like this macro will delete everything
except hidden text.:

Sub Macro13()
Dim aRange As Range

ActiveDocument.Range.TextRetrievalMode.IncludeHiddenText = False
Set aRange = ActiveDocument.Content

With aRange.Find
.Font.hidden = False
.Text = ""
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With

End Sub
>
> ' Reset to user's option, saved above
> Options.DeletedTextMark = DeletedTextOption
>
> --
> Enjoy,
> Tony
>
> "John Sharp" <John Sharp@discussions.microsoft.com> wrote in message
> news:1E62BE27-BE4C-44E6-90DC-508466E7AE83@microsoft.com...
>> I'm trying to write a macro that finds & replaces several things all in
> one
>> batch. Track changes needs to be on.
>>
>> The problem is that the "finds" also see and act on deleted text. How can
> I
>> run a find and replace that ignores the deleted text? I know this was a
>> problem in Word 97 because I found a KB article on it. Surely they fixed
> it
>> by now?
>>
>> I have tried limiting finds for black text or font style normal...that
>> doesn't work.
>
>

--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID


Re: Word 2003 Find/Replace Doesn't Ignore Deleted Text by Russ

Russ
Sat Sep 09 16:42:16 CDT 2006

Oops,
>
>
>
>
>
>> To make F&R ignore deleted text you need to make it hidden, something like
>> this ...
>>
>> Dim DeletedTextOption As WdDeletedTextMark
>>
>> ' Save the current user setting
>> DeletedTextOption = Options.DeletedTextMark
>> ' Override it with Hidden
>> Options.DeletedTextMark = wdDeletedTextMarkHidden
>> ' Make sure hidden text is not looked at
>> ActiveDocument.Range.TextRetrievalMode.IncludeHiddenText = False
>>
>> ' Do your Replace here
> Also an important distinction is that Selection.Find does not seem to work
> with TextRetrievalMode.
Selection.Find does work as long the Show/Hide Button isn't hiding the text
like:

ActiveWindow.ActivePane.View.ShowAll = False

Before doing a selection find. That doesn't seem to matter when using a
range find.

> You must use Range.Find. Something like this macro will delete everything
> except hidden text.:
>
> Sub Macro13()
> Dim aRange As Range
>
> ActiveDocument.Range.TextRetrievalMode.IncludeHiddenText = False
> Set aRange = ActiveDocument.Content
>
> With aRange.Find
> .Font.hidden = False
> .Text = ""
> .Replacement.Text = ""
> .Execute Replace:=wdReplaceAll
> End With
>
> End Sub
>>
>> ' Reset to user's option, saved above
>> Options.DeletedTextMark = DeletedTextOption
>>
>> --
>> Enjoy,
>> Tony
>>
>> "John Sharp" <John Sharp@discussions.microsoft.com> wrote in message
>> news:1E62BE27-BE4C-44E6-90DC-508466E7AE83@microsoft.com...
>>> I'm trying to write a macro that finds & replaces several things all in
>> one
>>> batch. Track changes needs to be on.
>>>
>>> The problem is that the "finds" also see and act on deleted text. How can
>> I
>>> run a find and replace that ignores the deleted text? I know this was a
>>> problem in Word 97 because I found a KB article on it. Surely they fixed
>> it
>>> by now?
>>>
>>> I have tried limiting finds for black text or font style normal...that
>>> doesn't work.
>>
>>

--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID