A Microsoft Word forum. Microsoft Office Word Forum - WordBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » Microsoft Office Word Forum - WordBanter forum » Microsoft Word Newsgroups » Page Layout
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Updating Fields on a save



 
 
Thread Tools Display Modes
  #1  
Old November 24th 04, 02:05 PM
jwknock
external usenet poster
 
Posts: n/a
Default Updating Fields on a save

Trying to create a template which holds the filename in the header. If you
save the document under a new name the filename field will only update on
printing if the box is ticked in Tools, Options, Printing. I would like to
force the field to update as soon as file is saved. I realise this possibly
should come under "programming" topic.
Ads
  #2  
Old November 24th 04, 08:35 PM
Jezebel
external usenet poster
 
Posts: n/a
Default

You'll need to write some code --

Dim pRange as Word.Range
For each pRange in ActiveDocument.StoryRanges
Do
pRange.Fields.update
set pRange = pRange.NextStoryRange
Loop until pRange is nothing
Next

That update all fields in your document, wherever they're located. (Apart
from headers and footers, fields in textboxes and footnotes also need to be
updated separately.)




"jwknock" wrote in message
...
Trying to create a template which holds the filename in the header. If you
save the document under a new name the filename field will only update on
printing if the box is ticked in Tools, Options, Printing. I would like to
force the field to update as soon as file is saved. I realise this

possibly
should come under "programming" topic.



  #3  
Old November 25th 04, 12:33 PM
jwknock
external usenet poster
 
Posts: n/a
Default

Thanks, I thought it would be something like that, where I'm stumped is how
to capture a SAve or Save as so I can do that update as soon as the user
saves the file under a new name.

"Jezebel" wrote:

You'll need to write some code --

Dim pRange as Word.Range
For each pRange in ActiveDocument.StoryRanges
Do
pRange.Fields.update
set pRange = pRange.NextStoryRange
Loop until pRange is nothing
Next

That update all fields in your document, wherever they're located. (Apart
from headers and footers, fields in textboxes and footnotes also need to be
updated separately.)




"jwknock" wrote in message
...
Trying to create a template which holds the filename in the header. If you
save the document under a new name the filename field will only update on
printing if the box is ticked in Tools, Options, Printing. I would like to
force the field to update as soon as file is saved. I realise this

possibly
should come under "programming" topic.




  #4  
Old November 25th 04, 12:59 PM
Greg Maxey
external usenet poster
 
Posts: n/a
Default

Maybe something like:

Sub FileSaveAs()



Dialogs(wdDialogFileSaveAs).Show

Dim pRange as Word.Range
For each pRange in ActiveDocument.StoryRanges
Do
pRange.Fields.update
set pRange = pRange.NextStoryRange
Loop until pRange is nothing
Next

System.Cursor = wdCursorNormal



End Sub

--
Greg Maxey/Word MVP
A Peer in Peer to Peer Support

jwknock wrote:
Thanks, I thought it would be something like that, where I'm stumped
is how to capture a SAve or Save as so I can do that update as soon
as the user saves the file under a new name.

"Jezebel" wrote:

You'll need to write some code --

Dim pRange as Word.Range
For each pRange in ActiveDocument.StoryRanges
Do
pRange.Fields.update
set pRange = pRange.NextStoryRange
Loop until pRange is nothing
Next

That update all fields in your document, wherever they're located.
(Apart from headers and footers, fields in textboxes and footnotes
also need to be updated separately.)




"jwknock" wrote in message
...
Trying to create a template which holds the filename in the header.
If you save the document under a new name the filename field will
only update on printing if the box is ticked in Tools, Options,
Printing. I would like to force the field to update as soon as file
is saved. I realise this possibly should come under "programming"
topic.



  #5  
Old November 25th 04, 08:32 PM
Jezebel
external usenet poster
 
Posts: n/a
Default

You capture user instructions by writing a macro of the same name. In this
case FileSave and FileSaveAs.


"jwknock" wrote in message
...
Thanks, I thought it would be something like that, where I'm stumped is

how
to capture a SAve or Save as so I can do that update as soon as the user
saves the file under a new name.

"Jezebel" wrote:

You'll need to write some code --

Dim pRange as Word.Range
For each pRange in ActiveDocument.StoryRanges
Do
pRange.Fields.update
set pRange = pRange.NextStoryRange
Loop until pRange is nothing
Next

That update all fields in your document, wherever they're located.

(Apart
from headers and footers, fields in textboxes and footnotes also need to

be
updated separately.)




"jwknock" wrote in message
...
Trying to create a template which holds the filename in the header. If

you
save the document under a new name the filename field will only update

on
printing if the box is ticked in Tools, Options, Printing. I would

like to
force the field to update as soon as file is saved. I realise this

possibly
should come under "programming" topic.






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you force a Save As in a Word based form? Diane R. Microsoft Word Help 2 January 12th 05 05:59 PM
Save and Save As tab disappeared from File Menu Karen Microsoft Word Help 2 January 10th 05 12:30 AM
How to save form fields Will Goldring Microsoft Word Help 4 December 14th 04 10:23 AM
Save As...*.txt files Scribe Microsoft Word Help 2 December 13th 04 04:45 AM
refreshing / updating fields GenesisBlade Microsoft Word Help 4 November 29th 04 01:45 PM


All times are GMT +1. The time now is 07:03 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.