UpdateFieldsAtPrint

L

Lee

Hi. I'm only new to VBA and use it only to create user forms for templates.
I have a template which has a user form that shows with a new document
(autonew - show form). The user then enters the information into the form
which in turn places the information throughout the document. (The code for
this sits in Sub cmdOK_Click [code runs when user presses the OK button]).

I want to add Options.UpdateFieldsAtPrint = True so that fields update when
document is printed but not exactly sure where to place it, e.g. in a new
module or in the code of the form or where?

I would appreciate anyone's help on this. Thanks
 
J

Jezebel

From the sounds of it, this setting becomes relevant when the user clicks
OK, so adding it to the cmdOK_Click event seems appropriate.

But bear in mind that that setting applies to ALL documents, not just yours;
so you should at least tell the user that you are changing it. Otherwise you
fall in to the category of 'ill-behaved applications'.
 
L

Lee

The field is the file location path therefore I want it to update when saved
or printed.

If Options.UpdateFieldsAtPrint = True changes the setting for all users,
then is there some other code that will update fields on save or print?

The user form in templates run on autonew therefore the document is saved
until after the code in the form runs. I do have some code in the form that
updates fields when user click OK button but I need the file location path to
update when saved or printed so the user knows where the document is saved.

Thanks for helping me with this.

Jezebel said:
From the sounds of it, this setting becomes relevant when the user clicks
OK, so adding it to the cmdOK_Click event seems appropriate.

But bear in mind that that setting applies to ALL documents, not just yours;
so you should at least tell the user that you are changing it. Otherwise you
fall in to the category of 'ill-behaved applications'.




Lee said:
Hi. I'm only new to VBA and use it only to create user forms for
templates.
I have a template which has a user form that shows with a new document
(autonew - show form). The user then enters the information into the form
which in turn places the information throughout the document. (The code
for
this sits in Sub cmdOK_Click [code runs when user presses the OK button]).

I want to add Options.UpdateFieldsAtPrint = True so that fields update
when
document is printed but not exactly sure where to place it, e.g. in a new
module or in the code of the form or where?

I would appreciate anyone's help on this. Thanks
 
J

Jean-Yves

Hi Lee,
Why not just use ActiveDocument.Fields.Update with the OK button code ?
Regards
Jean-Yves

Lee said:
The field is the file location path therefore I want it to update when
saved
or printed.

If Options.UpdateFieldsAtPrint = True changes the setting for all users,
then is there some other code that will update fields on save or print?

The user form in templates run on autonew therefore the document is saved
until after the code in the form runs. I do have some code in the form
that
updates fields when user click OK button but I need the file location path
to
update when saved or printed so the user knows where the document is
saved.

Thanks for helping me with this.

Jezebel said:
From the sounds of it, this setting becomes relevant when the user clicks
OK, so adding it to the cmdOK_Click event seems appropriate.

But bear in mind that that setting applies to ALL documents, not just
yours;
so you should at least tell the user that you are changing it. Otherwise
you
fall in to the category of 'ill-behaved applications'.




Lee said:
Hi. I'm only new to VBA and use it only to create user forms for
templates.
I have a template which has a user form that shows with a new document
(autonew - show form). The user then enters the information into the
form
which in turn places the information throughout the document. (The
code
for
this sits in Sub cmdOK_Click [code runs when user presses the OK
button]).

I want to add Options.UpdateFieldsAtPrint = True so that fields update
when
document is printed but not exactly sure where to place it, e.g. in a
new
module or in the code of the form or where?

I would appreciate anyone's help on this. Thanks
 
L

Lee

Because users save the document after pressing OK button. We use a Document
Management System which saves the document after the document has been typed
(or form has been filled out).

Jean-Yves said:
Hi Lee,
Why not just use ActiveDocument.Fields.Update with the OK button code ?
Regards
Jean-Yves

Lee said:
The field is the file location path therefore I want it to update when
saved
or printed.

If Options.UpdateFieldsAtPrint = True changes the setting for all users,
then is there some other code that will update fields on save or print?

The user form in templates run on autonew therefore the document is saved
until after the code in the form runs. I do have some code in the form
that
updates fields when user click OK button but I need the file location path
to
update when saved or printed so the user knows where the document is
saved.

Thanks for helping me with this.

Jezebel said:
From the sounds of it, this setting becomes relevant when the user clicks
OK, so adding it to the cmdOK_Click event seems appropriate.

But bear in mind that that setting applies to ALL documents, not just
yours;
so you should at least tell the user that you are changing it. Otherwise
you
fall in to the category of 'ill-behaved applications'.




Hi. I'm only new to VBA and use it only to create user forms for
templates.
I have a template which has a user form that shows with a new document
(autonew - show form). The user then enters the information into the
form
which in turn places the information throughout the document. (The
code
for
this sits in Sub cmdOK_Click [code runs when user presses the OK
button]).

I want to add Options.UpdateFieldsAtPrint = True so that fields update
when
document is printed but not exactly sure where to place it, e.g. in a
new
module or in the code of the form or where?

I would appreciate anyone's help on this. Thanks
 
R

Russ

Lee,Do you want a self-updating field for the full path and filename field?

The closest I think you can come to that, is to put a filename-with-path
field in the header or footer of the template that creates the document the
user is going to save.(Or use VBA code to insert the field in the header or
footer.) The field I tested 'looks like' this with the field code revealed:

{ FILENAME \p \*MERGEFORMAT }

I tested by saving the test document to a different directory each time. The
field results didn't change immediately, but when going into print preview
or printing the file, the field did update on its own, even with the "update
when printing" option turned off. The same field code placed in main body of
the document didn't update at all, until coerced manually or by running code
to update the field.
So in this case, field location makes a difference.

Because users save the document after pressing OK button. We use a Document
Management System which saves the document after the document has been typed
(or form has been filled out).

Jean-Yves said:
Hi Lee,
Why not just use ActiveDocument.Fields.Update with the OK button code ?
Regards
Jean-Yves

Lee said:
The field is the file location path therefore I want it to update when
saved
or printed.

If Options.UpdateFieldsAtPrint = True changes the setting for all users,
then is there some other code that will update fields on save or print?

The user form in templates run on autonew therefore the document is saved
until after the code in the form runs. I do have some code in the form
that
updates fields when user click OK button but I need the file location path
to
update when saved or printed so the user knows where the document is
saved.

Thanks for helping me with this.

:

From the sounds of it, this setting becomes relevant when the user clicks
OK, so adding it to the cmdOK_Click event seems appropriate.

But bear in mind that that setting applies to ALL documents, not just
yours;
so you should at least tell the user that you are changing it. Otherwise
you
fall in to the category of 'ill-behaved applications'.




Hi. I'm only new to VBA and use it only to create user forms for
templates.
I have a template which has a user form that shows with a new document
(autonew - show form). The user then enters the information into the
form
which in turn places the information throughout the document. (The
code
for
this sits in Sub cmdOK_Click [code runs when user presses the OK
button]).

I want to add Options.UpdateFieldsAtPrint = True so that fields update
when
document is printed but not exactly sure where to place it, e.g. in a
new
module or in the code of the form or where?

I would appreciate anyone's help on this. Thanks
 

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