Today, I had a closer look on the changes to the “AddIn” object and the new object “AddIns2” in Excel 2010. The “AddIn” object has been only extended by the property “IsOpen”, allowing to check programmatically if a specific Add-In is loaded or not. The new object “AddIns2” lists, unlike the already existing object “AddIns”, all available Add-Ins regardless if they have been installed or not. The following screenshot demonstrates this behaviour. First, I loaded the Add-In “Test.xla” by opening the file with the file open dialog.
Then, a simple loop through the two collections leads to the result shown above; there is one item more in the “AddIns2” collection. The new object contains following methods and properties:
- Function Add(Filename As String, [CopyFile]) As AddIn
This method seems to work in the same manner as the method contained in the “AddIns” object and loads an Add-In from a file and adds it to the installed Add-Ins list.
- Property Application As Application
The write protected property just returns an Application object, in this case Microsoft Excel.
- Property Count As Long
This write protected property returns the number of items contained in the collection.
- Property Creator As XlCreator
This property allows to retrieve the “creator code” and is primarly intended for the Macintosh. Each application has to identify itself by an application code on the Macintosh. If you transform the value “1480803660“ to its hexadecimal values, you should get “58 43 45 4C “. And if you then replace the values by their ASCII code, you should get “XCEL”.
- Property Item(Index) As AddIn
This property returns an AddIn object. So, you can use the methods and properties contained in this object like “Name” for the retrieving the Add-In name or “Path” for querying the path.
- Property Parent As Object
This property returns the parent object, in this case also Microsoft Excel.
Finally, I would like to recommend the post Migrating Excel 4 Macros to VBA on the Microsoft Excel Blog, where you can find more informations and also a section about the the “AddIns2” object.
This article has also been published in German and in English on the following sites:
- Excel Ticker Blog, German
- Professional Excel Solutions by Maninweb.de, English
- Professional Excel Solutions by Maninweb.de, German