Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word - Create One Big Document From Many Individual Docs

Status
Not open for further replies.

BruceG

Programmer
Dec 9, 2001
31
US
I'm working on a VB app to generate one big master Word document that is a compilation of many other individual Word docs. I'm doing this by repeatedly executing the "InsertFile" method.

I want the characteristics of the individual docs retained in the new master doc. (i.e., one master document that is really a bunch of independent documents stacked on top of one another, each with its original formatting, styles, tab stops, margin settings, etc. retained.)

I have already had some help on a different forum to make sure each doc's header, footer, and page # info was retained (by setting "LinkToPrevious = False", etc.); so that part is working fine.

However, I also want to make sure that each original doc's fonts, margin settings, tab stops, etc. are also retained in the new master doc.

The main problem that seems to be happening is that the default font size of the master doc seems to be overriding the font size in many places of the inserted doc.
Example: The default font size in Word is 12 (Times New Roman). When I insert the new doc (even after inserting a section break first), everywhere that the font is Times New Roman 10, I get Times New Roman 12 in the new doc ... (all other font sizes from the original doc are retained).

So, I'm trying to find out how to make Word NOT use the default font. Any help is appreciated ...

The real question is:
What VBA statements can I use to totally obliterate any "influence" a previous document might have on the new document being inserted?

 
Unfortunately I can not tell you a fix for this through VB but I can tell you what is happening. When I work on an individual subdocument, its formats and styles look different from the way they look in the expanded master document. When you insert a subdocument into a master document, Word displays the subdocument using the styles from the master document's template. All of the font and paragraph information is based on styles and at some level all styles are based on the Normal style which is where the document's default font is stored. When you are using documents as subdocuments which will be combined the best thing to do is have all of the documents (including the master) start with a standardized template which has one set of styles. Then, in the individual documents you can add additional styles which will be imported with file => import (I recommend using unsually names if you go this route). Or you can simply add direct formatting to a section of the text, without altering the style formatting, and the formatting will be retained. When the documents are combined, since they all have the same styles there should be no formatting issues.

Unfortunately it sounds as if you are beyond that point. If you are working with a relatively small number of documents it should not be too much trouble to alter the styles and come up with a base set but beyond that I am not sure of the best route to take. MS Word's help has a troubleshooting section under Master Documents which might give you ideas.
 
Thanks for the explanation, GoodOmens. I'm looking into various workarounds at this point ...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top