Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default add in persistent properties

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,939
Default add in persistent properties

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default add in persistent properties

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default add in persistent properties


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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 395
Default add in persistent properties

Are you interested in adding your properties to the add-in, or the actual
user workbooks? If it is the latter, consider using custom document
properties- in VBA they are easy to use (I don't have VSTO2008, but I assume
it is easy there too). These are generally not noticable to most users, they
will be workbook-specific (meaning the user can have two different workbooks
and have different settings on each), and your settings will travel with the
workbook even if opened on different PCs. If you need to have one set of
settings that affect every workbook for the same user, then you need to store
your values in your add-in or the registry.

HTH,
Keith

"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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22
Default add in persistent properties

Thanks Keith!
I will try using custom document properties for my solution.

Regards,

faffo1980

"ker_01" wrote:

Are you interested in adding your properties to the add-in, or the actual
user workbooks? If it is the latter, consider using custom document
properties- in VBA they are easy to use (I don't have VSTO2008, but I assume
it is easy there too). These are generally not noticable to most users, they
will be workbook-specific (meaning the user can have two different workbooks
and have different settings on each), and your settings will travel with the
workbook even if opened on different PCs. If you need to have one set of
settings that affect every workbook for the same user, then you need to store
your values in your add-in or the registry.

HTH,
Keith

"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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to handle persistent properties in Excel VBA 2003 faffo1980 Excel Programming 4 August 27th 10 05:46 AM
Persistent Storage for Add-Ins ? Brian Herbert Withun Excel Programming 2 January 25th 08 02:24 PM
Persistent classes [email protected] Excel Programming 1 November 13th 07 04:23 PM
Array Data Not Persistent Edd[_2_] Excel Programming 1 February 17th 06 06:47 PM
Persistent data in an Add-in Bura Tino Excel Programming 12 May 4th 04 07:20 PM


All times are GMT +1. The time now is 05:43 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"