Hook and handle Office built-in controls
in Outlook, Excel, Word, PowerPoint in Delphi
Add-in Express
for Borland VCL
Add-in Express Home > Add-in Express VCL > Online Guide > Handling built-in controls
Handling Office built-in controls
Add-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 wizard
In 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 module
In 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 component
Add the adxBuiltInControl component to the add-in module.
Step #4 - Specify the BuiltInID property
Set 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 action
Disable the standard action of the control via the DisableStandardAction property.
Step #6 - Handle the OnAction event
Handle the OnAction event:
procedure TAddInModule.OpenHookAction(
Sender: TObject);
begin
ShowMessage('I''ve done this!');
end;
Back to Add-in Express VCL homepage

