Re: Find and replace equations (Latin characters)
- From: "John McGhie [MVP - Word and Word Macintosh]" <john@xxxxxxxxxxx>
- Date: Sat, 08 Jul 2006 14:10:30 +1000
Hi Elliot:
The basic incantation for searching for a field is:
^d XE "The index text here"
It *sort of* works, depending on the field type (XE is an Index field). At
least, on the PC they do. I can't remember whether the quotes go in the
Find string or not: I think they do.
However, I usually do this stuff in VBA because I can be much more sure of
the result there. In VBA you iterate the "Fields" collection, looking for a
"Type". When you find each field of your specified Type, you can then
return the "Code" or the "Result".
These come back as ranges, from which you can retrieve the Text to find out
whether the content is the one you are looking for. If you return the Code,
you are looking at everything except the curly braces. If you return the
Result, you see only what the user would see when the field updates.
So using Code, you can change the field from one type to another. I have a
macro somewhere that does this to change Index tags into Hyperlinks (so you
can use a concordance file to stick hyperlinks in a reference manual...
Nasty, but it works...)
There's some examples in the VBA Help that work sort-of :-)
To pre-empt your next question: It is possible to Find/Replace the code in
fields using Find/Replace with field codes revealed. You have to set things
up very carefully, because the possibility of corrupting the document by
mangling field codes is quite high :-)
Cheers
On 8/7/06 2:12 AM, in article 070720061712369737%nospam@xxxxxxxxx, "Elliott
Roper" <nospam@xxxxxxxxx> wrote:
In article <1152287147.387062.188600@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
<fogharty@xxxxxxxxx> wrote:
OK, I messed with it all day and came up with a couple of fixes.
First, I did your "show fields" and did a search and replace of the end
of the equation "¯) " removing the extra space "¯)" and that worked!
But then I wanted to replace the equation with the proper unicode
character. The only way I could find to do this was to take the
original document, run the above macro, then select all and paste it
into a new doc as unformatted text. Then the equations come over as
plain text "i¯".
I then run another macro changing all the vowels, "i¯" to the proper
character, "ChrW(299)" or "i".
It means I have to redo some formatting that I lost when pasting as
plain text, but I think on shorter documents it's worth it.
Both fixes seem to convert to pdf and print ok. Hopefully I won't have
more problems a few years down the line.
Thanks for your help.
A pleasure. Thanks for posting back your results.
Plain text was a bit drastic, but if it works...
I'd be interested if anyone has a trick for searching for a particular
field with specified contents, then replacing the whole field. I'm
thinking of the first trick (search for field source string) followed
by a clever macro to select and then delete the surrounding field
before inserting the replacement text.
In Word v.X I did fractions as EQ fields. It might be fun to
automatically turn them into proper unicode fractions.
Then again, I could get a life instead.
;-)
--
Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.
John McGhie <john@xxxxxxxxxxx>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 (0) 4 1209 1410
.
- Follow-Ups:
- Re: Find and replace equations (Latin characters)
- From: Elliott Roper
- Re: Find and replace equations (Latin characters)
- References:
- Find and replace equations (Latin characters)
- From: fogharty
- Re: Find and replace equations (Latin characters)
- From: Elliott Roper
- Re: Find and replace equations (Latin characters)
- From: fogharty
- Re: Find and replace equations (Latin characters)
- From: Elliott Roper
- Find and replace equations (Latin characters)
- Prev by Date: Re: Picture behind my text not printing
- Next by Date: Word doing wacky auto-complete
- Previous by thread: Re: Find and replace equations (Latin characters)
- Next by thread: Re: Find and replace equations (Latin characters)
- Index(es):
Relevant Pages
|