Putting it all Together

By adding extra interfaces that a COM Add-In can choose to implement, Microsoft has created an easily extensible architecture that works across all the Office applications and across multiple development platforms—commonly VB6 and .NET. A feature-rich COM Add-In can implement all three interfaces (IDTExtensibility2, IRibbonExtensibility, and ICustomTaskPaneConsumer) to deliver its functionality. The sample XLVBADatePicker COM Add-In does this to create a custom task pane that contains the standard Month View control, with a RibbonX toggle button to control its visibility. To make it all work seamlessly, it handles the following events:

□ When the toggle button is clicked, the task pane is shown or hidden.

□ When the user closes the task pane, the toggle button is restored.

□ When a date is selected in the task pane, the value is put into the active cell.

□ When a cell containing a date is selected, the task pane shows that date in the calendar.

You can find the complete code for the COM Add-In at www.wrox.com, in the XLVBADatePicker folder in the sample downloads for this chapter.

0 0

Post a comment