更新域对象的结果。用于 Field 对象时,若更新成功则返回 True。
expression.Update
expression 必需。该表达式返回以上的一个对象。
更新域对象的结果。当用于 Fields 集合时,若更新正确,则返回 0(零),或返回一个 Long 值,该值代表第一个出错域的索引。
expression.Update
expression 必需。该表达式返回以上的一个对象。
应用于 Dialog、Index、LinkFormat、TableOfAuthorities、TableOfContents 和 TableOfFigures 对象的 Update 方法。
更新显示在内置 Microsoft Word 对话框中的值,更新指定的链接或更新指定索引中的条目、引文目录、图表目录或目录。
注意 可用 UpdatePageNumbers 方法更新目录或图表目录中项目的页码。
expression.Update
expression 必需。该表达式返回以上的一个对象。
本示例更新活动文档中的所有域。返回 0(零)值表明更新域时没有出错。
If ActiveDocument.Fields.Update = 0 Then
MsgBox "Update Successful"
Else
MsgBox "Field " & ActiveDocument.Fields.Update & _
" has an error"
End If
本示例更新活动文档中未被自动更新的域。
For Each afield In ActiveDocument.Fields
If afield.LinkFormat.AutoUpdate = False _
Then afield.LinkFormat.Update
Next afield
本示例更新活动文档中第一个图表目录。
If ActiveDocument.TablesOfFigures.Count >= 1 Then
ActiveDocument.TableOfFigures(1).Update
End If
本示例更新活动文档中第一个域,并在状态栏中显示消息,此消息指明该域是否更新成功。
If ActiveDocument.Fields(1).Update = True Then
StatusBar = "Field updated"
Else
StatusBar = "Error, field not updated"
End If
本示例返回引用“字体”对话框的 Dialog 对象,将用于 Selection 对象的字体更改为 Arial,更新对话框的值,并显示“字体”对话框。
Set myDialog = Dialogs(wdDialogFormatFont)
Selection.Font.Name = "Arial"
myDialog.Update
myDialog.Show