Microsoft.Office.Tools.Excel

This namespace contains a set of types that extend and support the Microsoft Excel object model
This includes the following types:
WorkbookBase and WorksheetBase classes - These are base classes for the ThisWorkbook and SheetN classes in document-level solutions
Workbook and Worksheet interfaces - These can be created at run-time in application-level solutions
Types used for SmartTag functionality
Various helper types, such as event arguments and delegates
Extended Objects - Host Items and Controls



You can access these item directly without having to traverse the Office object model.
Objects in this namespace are often referred to as VSTO objects.
VSTO supports adding both host items and host controls dynamically.
These are added to the Worksheet Controls collection
Excel controls tab of the toolbox in Visual Studio
Only the controls that can be added at design time are displayed on the toolbox


Why Bother

In document level customisations you might want to run some code when the user interacts with an object in your document level solution, but not when the user interacts with a similar object in another file.
When you have a Native object you can test whether that object has been extended using the GetVstobject and HasVstoObject methods.



InnerObject

If you ever need to pass the aggregate to an Excel object model method that requires the real com Excel object, you can obtain this by using the "InnerObject" property
this.NamedRangeItem.InnerObject



© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext