Microsoft Excel reporting and 
 data analyzing with practically no coding. 
 .Net, ActiveX, and VCL versions. 
 www.AfalinaSoft.com  

Home    Products    Downloads    Registered users    Support    Prices    Order    Primary Subscription

 

MS Office COM Add-ins. Microsoft Excel reporting 
 and data analyzing


Ho to create Office COM Add-in for Outlook, Excel, Word in Delphi

Office Add-in Express™. How to ...

Your first step to the big market



Please note, this is the old version of Add-in Express. Add-in Express 2008 for .NET, VSTO and Delphi are now available.

See also the latest version of Delphi HowTo for Outlook, Excel, Word.

AddIn_Initialize:

  1. How to access command bar
  2. How to create command bar
  3. How to specify the position of new commandbar
  4. How to create CommandBarEdit
  5. How to create CommandBarEdit with the label
  6. How to set text in CommandBarEdit
  7. How to change the width of CommandBarEdit control
  8. How to create CommandBarCombobox
  9. How to split CommandBarControls
  10. How to populate CommandBarCombobox
  11. How to create CommandBarDropdown
  12. How to initialize CommandBarDropdown
  13. How to split values in CommandBarCombobox
  14. How to change the dropdown width of CommandBarCombobox
  15. How to create CommandBarButton
  16. How to set the icon and caption of CommandBarButton
  17. How to create a new group in CommandBar
  18. How to insert CommandBarControl before another control
  19. How to create CommandBarPopup
  20. How to add CommandBarControl to the pop-up control (CommandBarPopup)
  21. How to add a menu item to the standard menu
  22. How to add CommandBarControl to the standard CommandBar
  23. How to add a custom submenu to the Excel's main menu
  24. How to add a button to the Excel's main menu

AddIn_ControlEvent:

  1. How to create an event handler of CommandBarEdit
  2. How to create an event handler of CommandBarCombobox
  3. How to create an event handler of CommandBarButton
  4. How to set the state of CommandBarButton
  5. How to find CommandBarControl
  6. How to disable CommandBarControl
  7. How to show / hide CommandBar
  8. How to protect / unprotect command bar
  9. How to enable / disable all CommandBarControls on the specified CommandBar

Special things:

  1. How to add to MS Excel a new worksheet function with an ADX add-in
  2. How to handle the FrontPage OnWindowActivate event
  3. How to add a new toolbar to the Inspector window of MS Outlook
  4. How to handle the ItemSend event of MS Outlook
  5. How to handle the TaskChange event of MS Project
  6. How to use XL Report.VCL inside an ADX add-in
  7. How to handle the WorkbookBeforeSave event of MS Excel
  8. How to scan Outlook folders
  9. How to handle the MouseClick event on presentation's objects (PowerPoint)
  10. How to add a new item to the context menu of the Selection (Word)
  11. How to handle Outlook's SelectionChange event. This is a complete solution that traps the event raised by Explorer and by the navigation buttons in Inspectors.
  12. How to get an access to the MAPIFolder within Outlook Property Page.
  13. How to handle the ExplorerClose event (Outlook).

AddIn_Initialize:

1. How to access CommandBar

var IStdBar: IaxpCmdBar;
...
IStdBar := FIXL.CommandBars.Item['Standard'];
Page Top

2. How to create CommandBar

AddCmdBar(CmdBarBtns2, NewCtrl);
Page Top

3. How to specify the position of new CommandBar

AddCmdBar(CmdBarEdits, NewCtrl, msoBarTop);
AddCmdBar(CmdBarBtns1, NewCtrl, msoBarLeft);
Page Top

4. How to create CommandBarEdit

AddEdit(CmdBarEdits, 'Edit1', Edt01Tag, 'This is an edit control', msoComboNormal, NewCtrl);
Page Top

5. How to create CommandBarEdit with the label

var
IEdt: IaxpEdit;
...
IEdt := AddEdit(CmdBarEdits, 'Edit2:', Edt02Tag, 'This is an edit control', msoComboLabel, NewCtrl);
Page Top

6. How to set text in CommandBarEdit

if NewCtrl then
IEdt.Text := 'abc';
Page Top

7. How to change the width of CommandBarEdit control

if NewCtrl then
IEdt.Width := 150;
Page Top

8. How to create CommandBarCombobox

var
ICBox: IaxpComboBox;
...
ICBox := AddComboBox(CmdBarEdits, 'Combo1', CBox01Tag, 'This is a combobox', msoComboNormal, false, NewCtrl);
Page Top

9. How to split CommandBarControls

if NewCtrl then
ICBox.BeginGroup := true;
Page Top

10. How to populate CommandBarCombobox

if NewCtrl then begin
ICBox.AddItem('First', EmptyParam);
ICBox.AddItem('Second', EmptyParam);
ICBox.AddItem('Third', EmptyParam);
ICBox.AddItem('Fourth', EmptyParam);
end;
Page Top

11. How to create CommandBarDropdown

ICBox := AddComboBox(CmdBarEdits, 'Combo2', CBox02Tag, 'This is a dropdown control', msoComboLabel, true, NewCtrl); if NewCtrl then begin
ICBox.AddItem('First', EmptyParam);
ICBox.AddItem('Second', EmptyParam);
ICBox.AddItem('Third', EmptyParam);
ICBox.AddItem('Fourth', EmptyParam);
end;
Page Top

12. How to initialize CommandBarDropdown

if NewCtrl then
ICBox.ListIndex := 1;
Page Top

13. How to split values in CommandBarCombobox

if NewCtrl then
ICBox.ListHeaderCount := 2;
Page Top

14. How to change the dropdown width of CommandBarCombobox

ICBox.DropDownWidth := 150;
Page Top

15. How to create CommandBarButton

AddButton(CmdBarBtns1, 'Click me', Btn01Tag, 'This is a standard button', '', msoButtonCaption, NewCtrl);
Page Top

16. How to set the icon and caption of CommandBarButton

var
IBtn: IaxpButton;
...
IBtn := AddButton(CmdBarBtns1, 'Fix me', Btn02Tag, 'This is a button with fixed state', 'ADDINXP', msoButtonIconAndCaption, NewCtrl);

Note: The 'ADDINXP' string is name of bitmap resource.

Page Top

17. How to create a new group in CommandBar

IBtn.BeginGroup := true;
Page Top

18. How to insert CommandBarControl before another control

AddButton(CmdBarBtns1, 'Show/Hide BigButtons', Btn04Tag, 'Show/Hide BigButtons commandbar', '', msoButtonCaption, NewCtrl, 3);
Page Top

19. How to create CommandBarPopup

var
IPopup: IaxpPopup;
...
IPopup := AddPopup(CmdBarBtns1, 'Pop-up', Popup01Tag, 'This is a pop-up control', NewCtrl);
Page Top

20. How to add CommandBarControl to the pop-up control (CommandBarPopup)

// Button
AddButton(CmdBarBtns1, 'Button7', Btn07Tag, 'This is a button', 'ADDINXP', msoButtonIconAndCaption, NewCtrl, -1, IPopup);
// Edit
AddEdit(CmdBarBtns1, 'Edit', Edt03Tag, 'This is an edit control', msoComboLabel, NewCtrl, -1, IPopup);
Page Top

21. How to add a menu item to the standard menu

var
IPopup: IaxpPopup;
MenuName: string;
...
MenuName := 'File'; // Warning! Depends on localization.
IDispatch(IPopup) := OLEVariant(CmdBars.ActiveMenuBar).Controls.Item[MenuName];
AddButton(MenuName, 'MyItem', 'MyItemTag', 'This is a my menu item', 'ADDINXP', msoButtonIconAndCaption, NewCtrl, MyPosition, IPopup);
Page Top

22. How to add CommandBarControl to the standard CommandBar

var
BarName: string;
...
BarName := 'Standard'; // Warning! Depends on localization.
AddButton(BarName, 'MyButton', 'MyButtonTag', 'My button hint', 'MyButtonBitmatResourceName', msoButtonIcon, NewCtrl, 1);
Page Top

23. How to add a custom submenu to the Excel's main menu

procedure TMyAddIn.AddIn_Initialize;
var
IPopup: IaxpPopup;
IsNew: boolean;
begin
inherited;
// Warning! The 'Worksheet Menu Bar' string is
// the Excel's menubar name and depends on
// localization. You can get the menubar name
// through CmdBars.Item[0].NameLocal
IPopup := AddPopup('Worksheet Menu Bar', 'My submenu',
'ADXHT001', '', IsNew, 5);
AddButton('Worksheet Menu Bar', 'Item 1',
'ADXHT001-01', '', '', msoButtonCaption, IsNew,
-1, IPopup);
AddButton('Worksheet Menu Bar', 'Item 2',
'ADXHT001-02', '', '', msoButtonCaption,
IsNew, -1, IPopup);
end;
Page Top

24. How to add a button to the Excel's main menu

procedure TADXHT001.AddIn_Initialize;
var
IPopup: IaxpPopup;
IsNew: boolean;
begin
inherited;
// Warning! The 'Worksheet Menu Bar' string is
// the Excel's menubar name and depends on
// localization. You can get the menubar name
// through CmdBars.Item[0].NameLocal
AddButton('Worksheet Menu Bar', 'My Button',
'ADXHT002', '', '', msoButtonCaption, IsNew, 6);
end;
Page Top



AddIn_ControlEvent:

1. How to create an event handler of CommandBarEdit

if Tag = Edit1Tag then
ShowMessage(Format('Ooops... I am the %s edit control.'#13'My new value is %s.', [Tag, (ICtrl as IaxpEdit).Text]));
Page Top

2. How to create an event handler of CommandBarCombobox

if Tag = CBox01Tag then
ShowMessage(Format('Hm... I am the %s combobox.'#13'My new value is %s.', [Tag, (ICtrl as IaxpComboBox).Text]));
Page Top

3. How to create an event handler of CommandBarButton

if Tag = Btn01Tag then
ShowMessage(Format('Hm... I am the %s button.', [Tag]));
Page Top

4. How to set the state of CommandBarButton

if Tag = Btn02Tag then begin
IBtn := ICtrl as IaxpButton;
if IBtn.State = msoButtonUp then
IBtn.State := TOLEEnum(msoButtonDown)
else
IBtn.State := TOLEEnum(msoButtonUp);
end;
Page Top

5. How to find CommandBarControl

var
IEdt: IaxpEdit;
...
IEdt := FindControl(CmdBarEdits, Edt01Tag, axpEdit) as IaxpEdit;
Page Top

6. How to disable CommandBarControl

if Tag = Btn03Tag then
if Assigned(IEdt) then
IEdt.Enabled := not IEdt.Enabled;
Page Top

7. How to show/hide CommandBar

if Tag = Btn04Tag then
CmdBars.Item['MyBar'].Visible := not CmdBars.Item['MyBar'].Visible;
Page Top

8. How to protect/unprotect CommandBar

if Tag = Btn05Tag then
if CmdBars.Item['MyBar'].Protection = msoBarNoProtection then
CmdBars.Item['MyBar'].Protection := msoBarNoResize + msoBarNoMove + msoBarNoChangeVisible
else
CmdBars.Item['MyBar'].Protection := msoBarNoProtection;
Page Top

9. How to enable/disable all CommandBarControls on the specified CommandBar

if Tag = Btn06Tag then
for i := 1 to CmdBars.Item['MyBar'].Controls_.Count do
CmdBars.Item['MyBar'].Controls_.Item[i].Enabled := not CmdBars.Item['MyBar'].Controls_.Item[i].Enabled;
Page Top



Special things:

1. How to add to MS Excel a new worksheet function with an ADX add-in

Download adxht-301-d7.zip (Delphi 7)
Page Top

2. How to handle the FrontPage OnWindowActivate event

Download adxht-302-d7.zip (Delphi 7)
Page Top

3. How to add a new toolbar to the Inspector window of MS Outlook

Download adxht-303-d7.zip (Delphi 7)
Page Top

4. How to handle the ItemSend event of MS Outlook

Download adxht-304-d7.zip (Delphi 7)
Page Top

5. How to handle the TaskChange event of MS Project

Download adxht-305-d7.zip (Delphi 7)
Page Top

6. How to use XL Report.VCL inside an ADX add-in

Download adxht-306-d7.zip (Delphi 7)
Page Top

7. How to handle the WorkbookBeforeSave event of MS Excel

Download adxht-307-d7.zip (Delphi 7)
Page Top

8. How to scan Outlook folders

Download adxht-308-d7.zip (Delphi 7)
Page Top

9. How to handle the MouseClick event on presentation's objects (PowerPoint)

Download adxht-309-d7.zip (Delphi 7)
Page Top

10. How to add a new item to the context menu of the Selection (Word)

Download adxht-310-d7.zip (Delphi 7)
Page Top

11. How to handle Outlook's SelectionChange event. This is a complete solution that traps the event raised by Explorer and by the navigation buttons in Inspectors.

Download adxht-312-d7.zip (Delphi 7)
Page Top

12. How to get an access to the MAPIFolder within Outlook Property Page.

Download adxht-313-d7.zip (Delphi 7)
Page Top

13. How to handle the ExplorerClose event (Outlook).

Download adxht-314-d7.zip (Delphi 7)
Page Top


How to get more details

 •  Add-in Express Demo

 •  Add-in Express Toys™

 •  Add-in Express Downloads


Developed for

Delphi 5, 6, 7
Excluding Delphi Personal


[ Download it ]

[ Order now ]

Immediate shipment




ADX Toys™

Free sample
add-ins with a complete source code based on Add-in Express.

[  Read more  ]




We are Borland 
 technology partner


Copyright © 1999-2006
All right reserved.
Privacy Policy

Write to WebMaster

Page Top
Add-in Express - Visual tool for Office customization