VBA example - insert Word subdocument in master file

C

Charles

Hi,

Could anyone send me a vba example about how to insert Word
sub-document into one existing Master document? Please help me.

I am using Win XP and Office XP.

Many thanks.

Charles
 
J

Jonathan West

Charles said:
Hi,

Could anyone send me a vba example about how to insert Word
sub-document into one existing Master document? Please help me.

I am using Win XP and Office XP.

If you record a macro while doing this by hand, then you will have code
which yu can then adapt as necessary.

But I recommend that you think very carefully about whether master documents
are a feature you want to use in your application. Take a look at this
article.

Why Master Documents corrupt
http://word.mvps.org/FAQs/General/WhyMasterDocsCorrupt.htm
 
C

Charles

Thanks Jonathan, unfortunately I have never used macro to do anything
so I don't know how to do it.

I actually have got some VBA code to insert sub-documents in a
predefined master file. The reason I choose master/subdocuments is my
manager wish to keep Word documents format/style consistence after
insert tens/hundreds of difference Word into one new Word file. What
he did was first format one master file, then inserts all subdocuments
into this master file (so all subdocuments will inherit master file's
format/style).

I know this sounds dangerous in terms of Word file corruption, do you
have any suggestions?

Thanks

Kind Regards,

Charles
 
J

Jonathan West

Charles said:
Thanks Jonathan, unfortunately I have never used macro to do anything
so I don't know how to do it.

These articles may help you get started on VBA

Getting To Grips With VBA Basics In 15 Minutes
http://word.mvps.org/FAQs/MacrosVBA/VBABasicsIn15Mins.htm

Creating a macro with no programming experience using the
recorder
http://word.mvps.org/FAQs/MacrosVBA/UsingRecorder.htm

What do I do with macros sent to me by other newsgroup readers
to help me out?
http://word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm
I actually have got some VBA code to insert sub-documents in a
predefined master file. The reason I choose master/subdocuments is my
manager wish to keep Word documents format/style consistence after
insert tens/hundreds of difference Word into one new Word file. What
he did was first format one master file, then inserts all subdocuments
into this master file (so all subdocuments will inherit master file's
format/style).

I know this sounds dangerous in terms of Word file corruption, do you
have any suggestions?

I would suggest instead that for each file, you create a new blank document
based on a template with the correct formtting that you have created for the
purpose, and then insert the document into the blank document, and then save
the new document under the same name in a separate folder.

Try doing this by hand first, to see if it gets the results you need. Then
record a macro while you are doing it. Then post the code here and somebody
will be able to help you automate this so that you can loop through a folder
full of files and process them in a batch.
 

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