我知道如何使用 VBA 在 Word 2010 中使用变量。但是,当文档关闭并重新打开时,它们都会被重置。
如何将变量永久存储在 Word 文档中?
最佳答案
这个可以用:
Sub Test()
ActiveDocument.Variables.Add Name:="PermanentVar", Value:=100
'ActiveDocument.Variables("PermanentVar").Delete
End Sub
检查是否保留:
Private Sub Document_Open()
Msgbox ActiveDocument.Variables("PermanentVar")
End Sub
关于vba - 如何使用 VBA 在 Word 2010 文档中永久存储变量?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26251525/