Update Method

Applies To

Dialog object, Field object, Fields collection object, Index object, LinkFormat object, TableOfAuthorities object, TableOfContents object, TableOfFigures object.

Description

Dialog object: Updates the values shown in a built-in Microsoft Word dialog box.

Field or Fields object: Updates the result of the specified object. When applied to a Field object, returns True if the field is updated successfully. When applied to a Fields collection, returns 0 (zero) if no errors occur when the fields are updated, or returns the index of the first field that contains an error.

Index, TableOfAuthorities, TableOfContents, or TableOfFigures object: Updates the entries shown in specified index, table of authorities, table of figures or table of contents.

LinkFormat object: Updates the specified link.

Note Use the UpdatePageNumbers method to update the page numbers of items in a table of contents or figures.

Syntax

expression.Update

expression An expression that returns an object in the Applies To list.

See Also

Dialogs property, LinkFormat property, UpdatePageNumbers method, UpdateSource method.

Example

This example updates all the fields in the active document. A return value of 0 (zero) indicates that the fields were updated without error.

If ActiveDocument.Fields.Update = 0 Then 
    MsgBox "Update Successful"
Else
    MsgBox "Field " & ActiveDocument.Fields.Update & " has an error"
End If
This example updates the first table of figures in the active document.

If ActiveDocument.TablesOfFigures.Count >= 1 Then
    ActiveDocument.TableOfFigures(1).Update
End If
This example updates the first field in the active document and displays a message in the status bar indicating whether or not the field was updated successfully.

If ActiveDocument.Fields(1).Update = True Then
    StatusBar = "Field updated"
Else
    StatusBar = "Error, field not updated"
End If
This example returns a Dialog object that refers to the Font dialog box. The font applied to the Selection object is changed to Arial, the dialog values are updated, and the Font dialog box is displayed.

Set myDialog = Dialogs(wdDialogFormatFont)
Selection.Font.Name = "Arial"
myDialog.Update
myDialog.Show
This example updates any fields in the active document that aren't updated automatically.

For Each afield In ActiveDocument.Fields
    If afield.LinkFormat.AutoUpdate = False Then afield.LinkFormat.Update
Next afield