Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() If the properties are specific the add-in itself (not specific to any particular workbook that might be processed by that add-in), you can either save the values in the system registry or create a <Serializable() class, serialize that to XML and then deserialize when the add-in is loaded. If the properties are specific to the workbook processed by your add-in, then you could save those values to an xlVeryHidden worksheet or in hidden Defined Names. E.g., ' Hidden Defined Names Dim WB As ExcelWorkbook WB = XLApp.ActiveWorkbook With WB.Names .Add "PropName1", 123, False .Add "PropName2", 345, False End With where XLApp is the reference to the XL Application passed in during OnConnection. To use a hidden sheet, use code like ' Hidden Sheet Dim WB As Excel.Workbook Dim WS As Excel.Worksheet WB = XLApp.ActiveWorkbook Try WS = WB.Worksheets("MyHiddenSheet") Catch WS = WB.Worksheets.Add() End Try WS.Visible = Excel.XlSheetVisibility.xlSheetVeryHidden WS.Range("A1").Value = "PropValue1" WS.Range("A2").Value = "PropValue2" WB.Save Cordially, Chip Pearson Microsoft Most Valuable Professional Excel Product Group, 1998 - 2009 Pearson Software Consulting, LLC www.cpearson.com (email on web site) On Thu, 10 Sep 2009 08:36:04 -0700, faffo1980 wrote: Hi Jim, thanks for your reply but I think I have not described my problem correctly: the properties are addin specific because they should be interpreted only by the addin but every workbook could have different values for these properties (they should be data workbook interpreted only by the add-in). Thanks again faffo1980 "Jim Thomlinson" wrote: You can write your settings to the registry... http://www.j-walk.com/ss/excel/tips/tip60.htm -- HTH... Jim Thomlinson "faffo1980" wrote: Hi, I'm developing an Excel AddIn with VSTO 2008. I would like to add to the workbook some addin specific properties and make them persistent. Which is the best way in your opinion? The simplest solution is to make a hidden worksheet containg these properties but I don't like it very much. Is there another way? Thanks for your help, faffo1980 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to handle persistent properties in Excel VBA 2003 | Excel Programming | |||
Persistent Storage for Add-Ins ? | Excel Programming | |||
Persistent classes | Excel Programming | |||
Array Data Not Persistent | Excel Programming | |||
Persistent data in an Add-in | Excel Programming |