Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2006

Tip: Looking for answers? Try searching our database.

UpdateFieldsAtPrint

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lee - 25 Aug 2006 02:14 GMT
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
Jezebel - 25 Aug 2006 03:28 GMT
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.
[quoted text clipped - 10 lines]
>
> I would appreciate anyone's help on this.  Thanks
Lee - 25 Aug 2006 03:49 GMT
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.
[quoted text clipped - 17 lines]
> >
> > I would appreciate anyone's help on this.  Thanks
Jean-Yves - 25 Aug 2006 12:23 GMT
Hi Lee,
Why not just use ActiveDocument.Fields.Update with the OK button code ?
Regards
Jean-Yves

> The field is the file location path therefore I want it to update when
> saved
[quoted text clipped - 40 lines]
>> >
>> > I would appreciate anyone's help on this.  Thanks
Lee - 28 Aug 2006 00:08 GMT
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).

> Hi Lee,
> Why not just use ActiveDocument.Fields.Update with the OK button code ?
[quoted text clipped - 45 lines]
> >> >
> >> > I would appreciate anyone's help on this.  Thanks
Russ - 02 Sep 2006 10:58 GMT
Lee,
>>> The field is the file location path therefore I want it to update when
>>> saved
>>> or printed.
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
[quoted text clipped - 49 lines]
>>>>>
>>>>> I would appreciate anyone's help on this.  Thanks

Signature

Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.