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 / January 2005

Tip: Looking for answers? Try searching our database.

Vba code to automatically update fields

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Brad Zenner - 04 Jan 2005 17:41 GMT
Kind of new to the VBA thing, and I have a word form that has a calculated
field in it, and was wondering if there's vba code that would automatically
update that field or all fields in a document?

Any advise is greatly appreciated.
Thanks
Brad Zenner
Greg - 04 Jan 2005 18:03 GMT
Brad,

Several ways to update fields.

Select it and press F9
CTRL+a (selects all) and press F9
If you have your print options set up to update fields at print, then
you can toggle to and from Print Preview.

If it is just fields in the maintext story of the document you can run
the following macro:

Sub NoName()
ActiveDocument.Fields.Update
End Sub

If you have fields in other text stories you can use:

Sub UpdateAllFiled()
Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
Do
oStory.Fields.Update
Set oStory = oStory.NextStoryRange
Loop until oStory is nothing
Next
End Sub

None of these methods are automatic.  If you want the results to be
completely automatic you will have to perform your calculation using a
protected online form.
Brad Zenner - 05 Jan 2005 03:28 GMT
Thanks a lot greg, that makes sense. You gave me a lot to think about.

On 1/4/05 12:03 PM, in article
1104861780.953676.321700@f14g2000cwb.googlegroups.com, "Greg"
<gmaxey@mvps.org> wrote:

> Brad,
>
[quoted text clipped - 27 lines]
> completely automatic you will have to perform your calculation using a
> protected online form.

Rate this thread:






 
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.