开发者

How / where to save persistent data using VBA in MS Project 2003

I'm currently writing a macro using the MS Project 2003 Visual Basic editor, for whi开发者_开发技巧ch 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.


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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜