Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要保存变量的值以备将来使用。为此,我参考了 Microsoft 的 VBA 参考。该页面告诉我,我可以将变量的值保存在文档的变量对象中。但是,即使将网站上的确切代码粘贴到我的 VBA 中,它也会抛出错误
运行时错误 424 需要对象
我试图执行的确切代码是
Sub AddDocumentVariable() ActiveDocument.Variables.Add Name:="Age", Value:=12 End Sub