G'day "Jim" <
[email protected]>,
Wow - what a lot of questions
Comments are inline.
Steve Hudson - Word Heretic
Want a hyperlinked index? S/W R&D? See WordHeretic.com
steve from wordheretic.com (Email replies require payment)
Jim reckoned:
I believe I created some confusion by using the wrong
terminology. I don't think I'm working with any *.dot
files and so I should not have used the term "template".
Correct

This clarifies some of your issues enormously
Rather, I am working with 40+ Word 2000 documents (a.k.a.
main merge documents?), linked to an Access 2000 db, that
contain merge fields and Word logic fields. The
documents at issue are these "main merge documents"
and the resulting merged documents, all of which, as I
understand it, are *.doc files.
The "main merge
documents" are opened via corresponding command button in
Access 2000.
Righto. So Access opens up an EXISTING document, does some merge
tricky, then a save as a to create a NEW document.
I wish to place VBA in each of the "main
merge documents" that will cause them to open, merge into
a new document, and then close, leaving only the new
document open. (I have received help with the precise
code to use.) I have recently learned that any code
associated with each of the "main merge documents" will
not be associated with the new merged documents.
Correct. You have to manually copy the codemodule across from inside
the vbproject.vbcomponents collection.
I want
to keep users from accessing the VBA for any "main merge"
documents. I have experimented with a few of the "main
merge documents", adding appropriate VBA and then
attempting to add protection via the VB editor, by right
clicking on the project and then clicking on "project
properties". Often, with respect to the "main merge
documents" I tried this with, I received
the message "Project protected. Project is unviewable".
AH HA! Righto, you have totally the wrong method. Here's what you have
to do.
Create a template for use only by your mail merge documents, whether
EXISTING or NEW (to give two sensible names to your thingies

).
Manually (or use the batch file processor from
www.mvps.org/word/FAQs/index.htm) attach that template to all EXISTING
files. If you ever CREATE a new document, use the templates parm to
attach this template to your documents.
Protect the vbproject and distribute to those users who need to create
NEW documents.
This template will then be available for the NEW files as they inherit
the settings from the EXISTING files.
However, after working at it, I learned that I can access
the "project properties" for the main merge Word
documents so long as I do the following: Open one
document at a time from Access, using the appropriate
command button (but do not open a 2d document); do not
open the documents via Word or by double clicking on
their icons; after completing work on one document, it is
necessary to close not just the document, but also Word,
before opening the next document. Sounds crazy and, no
doubt, I messed something up along the way, but this is
the only solution I have found. (I wonder if my problem
stems from deriving virtually all of the documents from a
single document via "Save As".)
This is correct and you aren't crazy. Access is running the show, so
it is controlling the Word linkage. You probably have some access vars
set the original word document that are holding their settings to the
original document. I'd need to see the Access code to suggest where
and how to release / re-acquire your document based variables.
Are there methods
whereby I can (a) avoid having to close Word each time
before adding a password or adding the desired VBA to the
Word Main Merge docs or (b)add a password or the above-
described VBA to all of the relevant Word Main Merge docs
at once.
You should be able to release any relevant vars. However, it is also
possible that just a simple oWordApp.DoEvents might solve your problem
as your code isnt allowing Word any timeshare to resolve the various
events that occur on opening, saving and closing your document.
I hope my questions make sense.
Actually, in the end they did
Thank you in advance.
Jim
No probs - good luck.