Help Document Merging in Word

M

Malik Al-Amin

Here's my situation. I have two documents. 1 is a TraceTree and the other is
a UseCase Document.
The trace tree is formatted like:
ucr100: Client Relationship
ucr100:1 Completed Logon
ucr100: Entitled to run this report

My UseCase is formatted like:
Client Relationship
Completed Logon
Entitled to run this report
Br6666 The user must have the 'client administrative reports'
entitlement enabled.
br6656 The report will be part of the report group.

What I'm doing is manually creating a third document. I'm taking the entire
usecase document and looking at the trace tree to see where I need to insert
additional detail from the tracetree to the usecase such as with "ucr100".
When this is the case, I also bold and change the color of the text. This
process is repeated until I've gone through all of the entries on the use
case. I then save this document as a seperate document so as to preserve all
three documents seperately. I want to automate this process but I'm not too
familiar with Word VBA. However I'm comfortable with both Visual Basic and
Access vba. So i don't know if I can open the usecase and loop through each
paragraph in the tracetree searching for my variable. Please I welcome any
advise you may have on this issue.
 
J

Jezebel

If you know VB and Access VBA you should have too much trouble with this.
Spend a bit of time with the Object Viewer to get the hang of the Word
object model. The short answer is, yes you can iterate the paragraphs --

Dim pPar as Word.Paragraph
Dim pTreeDoc as Word.Document
Dim pUseDoc as Word.Document

Set pTreeDoc = Documents.Open("C:\....")
Set pUseDoc = Documents.Open("C:\....")

For each pPar in pUseDoc.Paragraphs
...


But given that your source documents appear to be well-structured, it might
be simpler to create an array or collection of the Tree items, then iterate
that searching for the corresponding text in the usecase doc. Apart from
iterating the paragraphs, you can use Word's own Find function, or you can
use VB functions like Instr() operating on the body of the document as a
whole.
 
M

Malik Al-Amin

Thanks for the feedback. I'll try your suggestion tomorrow. I'm comfortable
with VB/VBA but just unfamiliar with the word object model. But like you
suggested, I'll spend some time with the object browser and familiarize
myself with it and give it a shot. Again, thanks

Malik
 

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