开发者

How do I store program state information in a saved excel file from an application-level add-in?

开发者 https://www.devze.com 2022-12-30 01:48 出处:网络
I\'m trying to make an application-level add-in for Excel and I would like to store certain information about the program\'s state.The information I want to store pertains t开发者_如何学Pythono the st

I'm trying to make an application-level add-in for Excel and I would like to store certain information about the program's state. The information I want to store pertains t开发者_如何学Pythono the state of each Excel file (rather than across all Excel files).


I use CustomDocumentProperties in the workbook itself (not the add-in)

http://www.dailydoseofexcel.com/archives/2004/07/16/custom-document-properties/

Then when I open a workbook, I check for the existence of the CDP to determine if it belongs to my app, if it's a particular type of file used by my app (for context sensitive menu items), and to read state information for that workbook.

That link doesn't show a good example of writing to CDP, but I think it looks like

ActiveWorkbook.CustomDocumentProperties.Add ...


There's also CustomProperties, which exists at both the workbook and worksheet level. I've been using that to store all sorts of information (including serialized object information) to the workbook.

0

精彩评论

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