FILLIN field - can they be disarmed in code.

D

dixie

I am opening a word document from a template via code in Microsoft Access.
In that cod, I am also closing the original .dot file so only one document
will open for printing or for alteration and printing. The template has
several FILLIN fields. My problem is that the user has to answer the
questions for the FILLIN fields before the template closes and then once
more for the Document1 copy of the template. Can I "disarm" these fields in
the template such that I can close it with the user only having to answer
once.

dixie
 
C

Cindy M -WordMVP-

Hi Dixie,

Hmmm, I'm not sure I'm following quite what your code is doing, since you
don't specify. But it sounds as if you're using the *.dot file incorrectly if
you're actually *opening it*. Your code should be using the .Add and not the
..Open method?
I am opening a word document from a template via code in Microsoft Access.
In that cod, I am also closing the original .dot file so only one document
will open for printing or for alteration and printing. The template has
several FILLIN fields. My problem is that the user has to answer the
questions for the FILLIN fields before the template closes and then once
more for the Document1 copy of the template. Can I "disarm" these fields in
the template such that I can close it with the user only having to answer
once.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
D

dixie

Thats what I thought Cindy, that the .dot file would not open, but it does.
Here is gist of my Access code to do the maiilmerge.



'Dim variables

Dim wrdApp As Word.Application

Dim wrdDoc As Word.Document

'create and instance of word

Set wrdApp = CreateObject("Word.Application")

wrdApp.Visible = True

Set wrdDoc = wrdApp.Documents.Add("c:\lettertemplates\letter.dot")

'perform mailmerge

wrdDoc.MailMerge.Execute

'close the original template document

wrdDoc.Close wdDoNotSaveChanges

'release references

Set wrdDoc = Nothing

Set wrdApp = Nothing

Can you comment on where my mistake may be.



dixie
 
C

Cindy M -WordMVP-

Hi Dixie,
Can you comment on where my mistake may be.
Can you tell me at exactly which lines the prompts are
appearing? (Maybe use F8 to step through a line at a time)
Is it on Documents.Add and then at MailMerge.Execute? That
would make sense, because
- FILLIN fields are automatically displayed when a new
document is created

- And also when Mailmerge executes

You might want to use ASK fields, instead, as these are NOT
automatically displayed when a new document is created.
(Use REF fields to display the user input)

An alternative would be to LOCK the fields (Ctrl+F11) in
the template, and once the document is already generated,
unlock them (wrddoc.Fields.Locked = False)

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update
Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any
follow question or reply in the newsgroup and not by e-mail
:)
 
D

dixie

Yes, that is where they are displayed. I was thinking, when you open a
normal Word document, the file normal.dot does not open. Why then when you
do it in code like this and identify the template file by name in that code,
does the template file open and force you to put code in to close it without
saving anything? I gather there is no way to simply open the file spawned
by the template without having the template open first?

dixie
 
C

Cindy M -WordMVP-

Hi Dixie,
Yes, that is where they are displayed. I was thinking, when you open a
normal Word document, the file normal.dot does not open. Why then when you
do it in code like this and identify the template file by name in that code,
does the template file open and force you to put code in to close it without
saving anything? I gather there is no way to simply open the file spawned
by the template without having the template open first?
I think you're misunderstanding how Word works, and what's happening. I
implied it in my last response, but I'll try spelling it out. See my previous
message again for ways to work around the (quite correct) behavior that's a
problem for you.

1. When you start Word, Normal.dot is automatically loaded as a global
template. Although this has nothing to do with what you're seeing, I mention
it because of your second sentence, above.

2. When you create a new document from a template, that template is also
loaded into memory, as it may contain toolbars, shortcuts, macros or AutoText
that are relevant to working in the document created from it. Again, I mention
this just for the sake of completeness, the actual loading of the template is
NOT what's causing what you see.

3. Since Word 95, Microsoft added functionality to the application: if a
template contains FILLIN fields, these are automatically activated when a new
document is created. You can't turn this off; Microsoft did this so that the
normal user would NOT require a macro to force their display. If you want a
template where this does NOT happen, ASK fields are available.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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