// Wenn man unter Delphi Vorlagen von Excel öffnen will, dann
// reicht ein einfaches "open" nicht, da *.xlt immer als *.xls
// geöffnet wird.


// Getestet mit D2010 unter Win7

uses comobj; 
 
const 
  __WICHTIG__ = True; 
 
var 
  xcl: OleVariant; 
 
procedure TForm2.Button1Click(Sender: TObject); 
begin 
  xcl := createOleObject('Excel.Application'); 
  xcl.Workbooks.Open('C:\Mappe1.xlt', emptyParam, emptyParam, emptyParam, 
    emptyParam, emptyParam, emptyParam, emptyParam, emptyParam, __WICHTIG__, 
    emptyParam, emptyParam, emptyParam, emptyParam, emptyParam); 
  xcl.visible := True; 
  // sonstwas 
end; 
 
procedure TForm2.FormDestroy(Sender: TObject); 
begin 
  if not VarIsEmpty(xcl) then 
    xcl.quit; 
end;
 



 

Zugriffe seit 6.9.2001 auf Delphi-Ecke