Excel2000 vs Excel_TLB

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

Excel2000 vs Excel_TLB
 
George Spears




Posts: 80
Joined: 2010-05-06
Hello,

I am trying to get a better understanding of using Excel2000 vs Excel_TLB. I am only interested in Excel 2016 and later.
I know they are both Type libraries, but is Excel_TLB a superset of Excel2000? Can I get some clarity on the differences, or when to use one vs. the other? Is only one every needed? Does Add-In Express support both, etc.

Thanks
Posted 01 Aug, 2022 10:09:39 Top
Andrei Smolin


Add-in Express team


Posts: 19122
Joined: 2006-05-11
Hello George,

Excel2000 is the name of the unit providing the Excel 2000 type library's interfaces to your code. Excel_TLB is not something that I recognize. I suppose you talk about importing the type library of some Excel version (e.g. 2016) to a unit called Excel_TLB. This would be similar to my using the unit called Outlook_TLB in the code example at https://www.add-in-express.com/forum/read.php?FID=1&TID=12731&MID=64876#message64876.

You should understand that for compatibility reasons Add-in Express itself only works with type libraries of Office 2000. This means that whenever you *get* an Office object from Add-in Express, the object is from the corresponding type library of Office 2000. Say, you can write this code:


procedure TAddInModule.adxExcelAppEvents1SheetActivate(ASender: TObject;
  const Sh: IDispatch)
var app: Excel2000._Application;
begin
  app := self.ExcelApp.Application;
  // whatever
end;


The Delphi version I use provides the source code describing the type library of Excel 2010. If I compile Excel2010.pas and name the resulting unit Excel_TLB I can write this code:


procedure TAddInModule.adxExcelAppEvents1SheetActivate(ASender: TObject;
  const Sh: IDispatch)
var app: Excel_Tlb._Application;
begin
  app := self.ExcelApp.Application as Excel_Tlb._Application;
  // whatever
end;


Since you work with Office 2016, you have two ways. If your Delphi version provides the source code describing the type library of Excel 2016, you can simply compile it. If there's no source code, your only option is to import that type library. Anyway, when you have a unit covering the type library of Excel 2016, you use it in the fashion above.

Regards from Poland (CEST),

Andrei Smolin
Add-in Express Team Leader
Posted 02 Aug, 2022 09:50:30 Top