Proper launching of Excel from Delphi

Add-in Express™ Support Service
That's what is more important than anything else

Proper launching of Excel from Delphi
Delphi Excel launch variant add-ins 
Larry X


Serious Developer


Posts: 34
Joined: 2011-04-22
What is the proper way to launch Excel fr om Delphi so that add-ins and registered Active X servers are available to the Excel user?

I do

App := CreateOleObject('Excel.Application'); // where App is a variant

This works BUT addins and registered Active X servers are unknown, wh ereas if I start Excel from Start|Programs all is well.

Any help much appreciated.

Best,

Larry
Posted 25 Apr, 2011 22:11:55 Top
Dmitry Kostochko


Add-in Express team


Posts: 2875
Joined: 2004-04-05
Hi Larry,

As far as I know only XLLs, workbooks that are located in the XLStart directory and user defined functions are not loaded when Excel is started via OLE automation. COM add-ins are loaded.

You can use the following code to "refresh" the state of your UDF add-in:

  for i := 1 to App.AddIns.Count do begin
    if App.AddIns.Item[i].Name = 'YOUR_ADDIN_DLL_NAME' then begin // 'adxUDFTest.dll' in my case
      App.AddIns.Item[i].Installed := False;
      App.AddIns.Item[i].Installed := True;
      Break;
    end;
  end;


Or, you can use the CreateProcess or ShellExcecute functions to start Excel, if acceptable.
Posted 26 Apr, 2011 07:44:18 Top