I want to add a document (#2) to the end of my master document (#1). However, I wish to retain all of the styles of document #2 while leaving the master document styles alone. In my macro, what code will allow me to do this (i.e. supress styles update)?
In other words, if Doc#2 has a Yadda style, and the master doc template has a Yadda style - and they are different format - then the master doc style will apply.
How are you adding Doc#2? InsertFile? Copy/Paste?
If it is a paste, you could try using:
PasteAndFormat(wdFormatOriginalFormatting)
Frankly, while Microsoft has tried for years to get Master/Sub documents working, IMO, they never have worked well. I have tried using Master/Sub and it has never worked well.
As per Gerry's comments, I hope you're not using Word's Master Document 'feature' - that way lies grief (in the form of document corruption).
Assuming you've simply got two ordinary documents - a 'target document' into which you wish to import material from a 'source' document, the material from the source document will adopt the formatting of any like-named Styles in the target document, unless you're using copy & paste and use the 'Keep source formatting' option (Word 2003 & later). I believe that, when you do this via vba, the relevant code (from Word 2007) is:
Options.PasteFormatBetweenDocuments = 0
Options.PasteFormatBetweenStyledDocuments = 0
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.