Hook and handle Office built-in controls
in Outlook, Excel, Word, PowerPoint in Delphi
Add-in Express™ Handling Office built-in controlsAdd-in Express allows you to "hook" all built-in controls of Excel, Outlook, Word, PowerPoint and other Office host applications including menu items, buttons, edit boxes, etc. For example, we will hook the Open button of Microsoft Excel. Step #1 - Run the COM Add-in wizardIn the Delphi IDE, close all opened projects, select the File | New | Other item on the main menu, and run the Add-in Express COM Add-in wizard on the Add-in Express VCL tab of the New Item dialog box. Enter the name of the project, the add-in coclass name and the destination folder for the project, click Next and then click Finish. The wizard generates a new project and opens it in the Delphi IDE. When the wizard is finished, the add-in project will be created and opened in the Delphi IDE. Step #2 - Customize the add-in moduleIn the Project Manager window, select the add-in module, activate the Object Inspector, name your add-in via the AddInName property (this name will appear in the COM add-ins dialog box of the host applications), select Excel as a host application, and set True to the XLAutomationAddIn property. Step #3 - Add the adxBuiltInControl componentAdd the adxBuiltInControl component to the add-in module.
Step #4 - Specify the BuiltInID propertySet the ID of the control you need. To get this and other ID you can use our free tool to find commandbar control IDs.
Step #5 - Disable the standard actionDisable the standard action of the control via the DisableStandardAction property.
Step #6 - Handle the OnAction eventHandle the OnAction event:
|