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

Tip: Looking for answers? Try searching our database.

Turning on Update Fields/Links macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kamran - 02 Mar 2005 15:15 GMT
I need help writing a macro that will automatically turn on Update Fields,
Update Links, and turn on Field Shading Always when the document is opened.  
Thanks.
Greg - 02 Mar 2005 15:32 GMT
Karman,

Something like:

Sub AutoOpen()

ActiveDocument.Fields.Update
ActiveWindow.View.FieldShading = wdFieldShadingAlways
Options.UpdateLinksAtOpen = True

End Sub

Note:  The update fields is a one time shot.
Kamran - 02 Mar 2005 15:55 GMT
Thanks, Greg.  I took your cue and added:

Options.UpdateLinksAtPrint = True
Options.UpdateFieldsAtPrint = True

I just needed to set Word options to update fields at printing, since most
regular users don't have them turned on (and don't even know what they're
for).

I'm not a programmer, but isn't there a way to write a macro that when you
open the document it sets options in the user's Normal.dot that sets Field
Shading to Always?

> Karman,
>
[quoted text clipped - 9 lines]
>
> Note:  The update fields is a one time shot.
Greg - 02 Mar 2005 15:35 GMT
Actually to update all fields, remove the line:
ActiveDocument.Fields.Update
from the code I sent earlier and replace with:

Dim oStory As Range
For Each oStory In ActiveDocument.StoryRanges
 oStory.Fields.Update
 If oStory.StoryType <> wdMainTextStory Then
   While Not (oStory.NextStoryRange Is Nothing)
     Set oStory = oStory.NextStoryRange
     oStory.Fields.Update
   Wend
 End If
Next oStory
Set oStory = Nothing
Kamran - 02 Mar 2005 15:57 GMT
I don't understand what this one does since I'm not a programmer.  Maybe an
earlier question I just posted will simplify things.

> Actually to update all fields, remove the line:
> ActiveDocument.Fields.Update
[quoted text clipped - 11 lines]
> Next oStory
> Set oStory = Nothing
 
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.