C
Chris Ellis
Hi,
I'm writing an add-in for Word that does a lot of find/replace
operations. Some of these I do using Range.Find.Execute2007... for more
complex problems I built a Regex find/replace engine. There is one point at
which I am performing two searches back to back on the same range (two
duplicates of the same range, that is). Both strings are present in the
range. When I attempt to debug it I can verify this. One find succeeds,
the second one fails, but if I reverse the order, the same one fails whether
before or after the other... well... here's the text in the range that I'm
searching:
=========================================================================
"SCHEDULE A
TRUST ESTATE PROPERTY
The following described property is hereby conveyed and transferred to, and
deposited with TRUSTEE, Trustee of THE REVOCABLE LIVING TRUST, subject to
the terms and conditions of the foregoing Trust Agreement:
Real Estate:
All real estate wherever situated, owned by Grantor or in which Grantor has
an interest.
Personal Property:
1. All cash, gold or silver bullion or coins, checking accounts, savings
accounts, certificates of deposit, money fund deposits, or similar cash or
cash equivalent accounts now held in the name of Grantor.
2. All stocks, bonds, investments, and securities of any nature whatsoever
now owned beneficially or of records by Grantor.
3. All notes, contracts, mortgages, and deeds of trust receivable (if any)
now owned by Grantor.
4. All household furnishings, goods, and appliances, and all jewelry and
personal effects, or other personal property of any nature and wherever
situated (except motor vehicles) now owned by Grantor.
All of the above-described property consisted of, or while held in trust
hereunder, shall be deemed to be separate property of Grantor.
Dated the _________ day of _____________________, 2008.
, GRANTOR"
=========================================================================
the two ops are:
rng.Find.Execute2007("TRUSTEE", True) <- returns True
rng.Find.Execute2007("THE REVOCABLE LIVING TRUST", True) <- returns False
walking the code, the above are what the code boils down to, though my
actual code calls my own find function, passing range and text for which to
search as parameters... and it does first make a duplicate of the range...
the calls above are the ones that are actually being made in the heart of my
own little find/replace system... and I have verified that in both the range
text is the text above...
no matter the order, the first one above (TRUSTEE) always succeeds and the
second one always fails, but it seems clear to me that both are in the
range. Am I doing something fundamentally wrong here? Is this a known
issue? If so, any work-arounds? If I use my own regex system it works just
fine, but my concern is that I am using Word's internal find throughout my
add-in, but I have not taken the time to check to make sure that every find
is working as it ought to... if, after my code finishes running, I go into
Word and open its Find window and copy/paste the quote directly out of my
code, it finds "THE REVOCABLE LIVING TRUST" just fine... so I'm stumped...
Thank you,
Chris
I'm writing an add-in for Word that does a lot of find/replace
operations. Some of these I do using Range.Find.Execute2007... for more
complex problems I built a Regex find/replace engine. There is one point at
which I am performing two searches back to back on the same range (two
duplicates of the same range, that is). Both strings are present in the
range. When I attempt to debug it I can verify this. One find succeeds,
the second one fails, but if I reverse the order, the same one fails whether
before or after the other... well... here's the text in the range that I'm
searching:
=========================================================================
"SCHEDULE A
TRUST ESTATE PROPERTY
The following described property is hereby conveyed and transferred to, and
deposited with TRUSTEE, Trustee of THE REVOCABLE LIVING TRUST, subject to
the terms and conditions of the foregoing Trust Agreement:
Real Estate:
All real estate wherever situated, owned by Grantor or in which Grantor has
an interest.
Personal Property:
1. All cash, gold or silver bullion or coins, checking accounts, savings
accounts, certificates of deposit, money fund deposits, or similar cash or
cash equivalent accounts now held in the name of Grantor.
2. All stocks, bonds, investments, and securities of any nature whatsoever
now owned beneficially or of records by Grantor.
3. All notes, contracts, mortgages, and deeds of trust receivable (if any)
now owned by Grantor.
4. All household furnishings, goods, and appliances, and all jewelry and
personal effects, or other personal property of any nature and wherever
situated (except motor vehicles) now owned by Grantor.
All of the above-described property consisted of, or while held in trust
hereunder, shall be deemed to be separate property of Grantor.
Dated the _________ day of _____________________, 2008.
, GRANTOR"
=========================================================================
the two ops are:
rng.Find.Execute2007("TRUSTEE", True) <- returns True
rng.Find.Execute2007("THE REVOCABLE LIVING TRUST", True) <- returns False
walking the code, the above are what the code boils down to, though my
actual code calls my own find function, passing range and text for which to
search as parameters... and it does first make a duplicate of the range...
the calls above are the ones that are actually being made in the heart of my
own little find/replace system... and I have verified that in both the range
text is the text above...
no matter the order, the first one above (TRUSTEE) always succeeds and the
second one always fails, but it seems clear to me that both are in the
range. Am I doing something fundamentally wrong here? Is this a known
issue? If so, any work-arounds? If I use my own regex system it works just
fine, but my concern is that I am using Word's internal find throughout my
add-in, but I have not taken the time to check to make sure that every find
is working as it ought to... if, after my code finishes running, I go into
Word and open its Find window and copy/paste the quote directly out of my
code, it finds "THE REVOCABLE LIVING TRUST" just fine... so I'm stumped...
Thank you,
Chris