anni
Wed Feb 14 03:56:00 CST 2007
It works. Thanks you verry verry much, Graham.
--
Anni
Graham Mayor skrev:
> Most fields do not 'automatically' update. You have to force an update. You
> could intercept the FileSave and FileSaveAs routines in the document
> template to update the fields on save eg
>
> Sub FileSave()
> Dim oStory As Range
> ActiveDocument.Save
> 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
> End Sub
>
> and
>
> Sub FileSaveAs()
> Dim oStory As Range
> Dialogs(wdDialogFileSaveAs).Show
> ActiveWindow.Caption = ActiveDocument.FullName
> 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
> End Sub
>
> should work for most circumstances.
>
>
> --
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
> Graham Mayor - Word MVP
>
> My web site www.gmayor.com
> Word MVP web site
http://word.mvps.org
> <>>< ><<> ><<> <>>< ><<> <>>< <>><<>
>
> Anni wrote:
> > Hi
> > I have a field for "last save by" in document. When I save, I would
> > this field should automatic update.Please help!
>
>
>