Copying document layout settings and stop list numbers propogating

B

Barry555

Hello,

I've coded an Access app to produce .doc letters in Word using a .dot file
with bookmarks. To aid the user who has to print off the resultant letters
(might be 100s) I copy each letter produced into a single MasterDoc file,
then the user just has one file to print. This is all fine except for two
problems:

1. The MasterDoc file doesn't inherit the layout/page setup settings (e.g.
margins) from the inserted letters.
2. There is a numbered list in the .dot file. As each resultant letter
gets added into MasterDoc, the numbered list (in the letter in MasterDoc, the
individual letters are fine) increments instead of starting from 1!

Some of the code is:

Set objMasterDoc = objWord.Documents.Add()
Set rst = ...
Do
Set objDoc = objWord.Documents.Add(strTemplate)

....

objDoc.SaveAs strLetterPath
objDoc.Close

With objMasterDoc.Application.Selection
.InsertFile FileName:=strLetterPath, ConfirmConversions:=False
.InsertParagraphAfter
.InsertBreak Type:=2 'wdSectionBreakNextPage
.Collapse Direction:=0 'wdCollapseEnd
End With

.MoveNext
Loop Until rst.EOF

To combat problem 1, could I (and if so how!) do:

Set objMasterDoc = objWord.Documents.Add(strTemplate)

and then use code to strip out all text, bookmarks and headers and footers.

As for problem 2, I don't have a clue!

Thanks,

Barry
 
J

Jean-Guy Marcil

Barry555 said:
Hello,

I've coded an Access app to produce .doc letters in Word using a .dot file
with bookmarks. To aid the user who has to print off the resultant letters
(might be 100s) I copy each letter produced into a single MasterDoc file,
then the user just has one file to print. This is all fine except for two
problems:

It would be a lot easier if you generate the letters in a dedicated folder,
and then ran a batch command to print all the documents in the said dedicated
folder.

Failing that, make sure the Master file is identical to the "*.dot" file you
use to create the individual letters.
After that, another option would be to convert all the autonumbers in the
individual letters to static text with the
"ActiveDocument.ConvertNumbersToText" method. If you need to save the letters
with their list numbers intact, save the letters, convert the numbers to
text, transfer the letters to the master doc, then close without saving each
letter.
 
B

Barry555

Hello Jean-Guy,

Apologies for the delay in replying, awful cold!

The client prefers to have all the letters in one document for ease of
checking and controlling the printing.

I can't create the MasterDoc file beforehand as the users change templates
all the time. What I'd like to do is:

Set objMasterDoc = objWord.Documents.Add(strTemplate)

and then have code to strip out all text, headers and footers and bookmarks.

Thanks,

Barry
 
J

Jean-Guy Marcil

Barry555 said:
Hello Jean-Guy,

Apologies for the delay in replying, awful cold!

The client prefers to have all the letters in one document for ease of
checking and controlling the printing.

Then see my suggestion (below) regarding converting list numbers to static
text.
I can't create the MasterDoc file beforehand as the users change templates
all the time. What I'd like to do is:

Set objMasterDoc = objWord.Documents.Add(strTemplate)

If users are using all kinds of different templates, why can't you use the
Normal Template?
and then have code to strip out all text, headers and footers and bookmarks.

Not sure, but is there a question here?

----
 
B

Barry555

Hi,

Haven't had a chance to try your solution to the numbering problem yet, but
I have solved the copying document layout setting problem. It was as simple
as:

Set objMasterDoc = objWord.Documents.Add(strTemplate)
objMasterDoc.Content.Delete

strTemplate being the Word template used to generate the individual letters.
The Normal template can't be used, because it doesn't inherit settings (such
as page margins) from the inserted file (see my original email for the code
on how I insert each file into the Masterdoc file).

Regards,

Barry
 

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