Compare text then highlight difference ...

G

Grenier

From ACCESS I'm using word via automation to generate a report.
Was wondering if this was possible ?

I'd like to compare 2 string and highlight only the difference between them.
Those strings can be words, phrases, paragraph or several paragraph.

Could I use Word's built-in fonctions to achieve this ? Or using some very
clever vba code ?

Merci !
JF Grenier
 
C

Cindy M.

Hi =?Utf-8?B?R3Jlbmllcg==?=,
From ACCESS I'm using word via automation to generate a report.
Was wondering if this was possible ?

I'd like to compare 2 string and highlight only the difference between them.
Those strings can be words, phrases, paragraph or several paragraph.

Could I use Word's built-in fonctions to achieve this ? Or using some very
clever vba code ?
Well, Word has the "Compare Documents" feature that will compare the entire
content of two documents and create a result where the differences are
highlighted.

Beyond that, all you can do is have your code analyse each character in the two
strings (in a loop) and apply some kind of foramtting (or highlight) to the
characters that don't match.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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