Microsoft Word 2003中的 DOCVARIABLE 是什么?我该如何设置?如何在Word文档中显示它?

有帮助吗?

解决方案 2

如何在word文档中显示:

Insert-> Field-> Category:DocumentAutomation-> Field Names:DocVariable-> Field COdes Button->然后输入变量的名称。

其他提示

  

您可以使用Microsoft Visual Basic for Applications Variables集合来设置和检索Word文档或模板中字符串变量的内容。

     

此外,您可以使用DocVariable字段在设置为在Word文档中显示后检索文档变量的值。

来源:如何在Word文档中存储和检索变量

Sub GetSetDocVars()

Dim fName As String
fName = "Jeff Smith"
' Set contents of variable "fName" in a document using a document
' variable called "FullName".
ActiveDocument.Variables.Add Name:="FullName", Value:=fName
' Retrieve the contents of the document variable.
MsgBox ActiveDocument.Variables("FullName").Value

End Sub
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top