如何/在何处使用 MS Project 2003 中的 VBA 保存持久数据

发布于 2024-09-30 14:49:32 字数 189 浏览 9 评论 0原文

我目前正在使用 MS Project 2003 Visual Basic 编辑器编写宏,为此我需要保存 Excel 电子表格模板的路径。我希望用户能够更改路径并将设置永久保存在某处。

是否有一个方便的位置可以使用 VBA for MS Project 2003 保存持久数据?我想也许在 Global.mpt 的自定义字段中,但我不知道如何访问它。

I'm currently writing a macro using the MS Project 2003 Visual Basic editor, for which I need to save a path to an template excel spreadsheet. I'd like the user to be able to change the path and for the setting to be persistently saved somewhere.

Is there a convenient location to save persistent data using VBA for MS Project 2003? I was thinking perhaps in a custom field of Global.mpt, but I'm not sure how to access it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

‖放下 2024-10-07 14:49:32

VBA 有两个内置函数 GetSettingSaveSetting,允许您简单、安全地将持久字符串数据保存到注册表。数据保存在 HKEY_CURRENT_USER 配置单元之外的文件夹中,因此数据是由用户保存的,而不是由机器保存的。

有关详细信息,请参阅此处:使用 GetSetting 和 SaveSetting 函数读取和写入注册表设置

VBA has two built-in functions GetSetting and SaveSetting that allow you to simply and safely save persistent string data to the registry. The data is saved in a folder off of the HKEY_CURRENT_USER hive, so the data is saved by user, not by machine.

See here for details: Use the GetSetting and SaveSetting Functions to Read and Write Registry Settings

忘你却要生生世世 2024-10-07 14:49:32

如果文件在另一个系统中使用,则使用注册表存储持久数据将不起作用。
您可以使用 CustomDocumentProperties 来存储您想要的任何值,它将与文件一起存储。

Using Registry to store persistent data will not work if the file is used in another system.
You could use the CustomDocumentProperties to store any value you want and it'll be stored along with the file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文