Compare, add and delete paragraphs

T

test by beginner

Hello everyone,

I have two similar files containing names and addresses of clients (each
client is in separate lines), I need to compare these two files and delete
similar paragraphs in one fine and then copy/paste the rest of paragraphs
from one to another to complete the 2nd file.

Is it possible to do this by writing visual basic codes? by the way I'm
using office word 2007.

any helps would be greatly appreciated.
 
D

Doug Robbins - Word MVP

Easier if you use Access, which has a find duplicates and a find unmatched
query wizard.

Alternatively, copy all of the records from one file into the other, sort
them and then use a Wildcard Replace to get rid of the duplicates

See the article "Finding and replacing characters using wildcards" at:

http://www.word.mvps.org/FAQs/General/UsingWildcards.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
?

***

Ok, Thank you


Doug Robbins - Word MVP said:
Easier if you use Access, which has a find duplicates and a find unmatched
query wizard.

Alternatively, copy all of the records from one file into the other, sort
them and then use a Wildcard Replace to get rid of the duplicates

See the article "Finding and replacing characters using wildcards" at:

http://www.word.mvps.org/FAQs/General/UsingWildcards.htm


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
H

Helmut Weber

then (pseudocode untested)

dim Prg1 as paragraph
dim Prg2 as paragraph
for each prg1 in activedocument.paragraphs
for each prg2 in activedocument.paragraphs
if prg1.range.text = prg2.range.text and_
prg1.range.start <> prg2.range.start then _
prg2.range.delete
endif
next
next


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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