Try something like this.

            LExcel := CreateOleObject('Excel.Application');
          try
            //LExcel.Visible := True;
            LExcel.Interactive := False;
            LExcel.IgnoreRemoteRequests := True;
            
                ...
                
                LExcel.ActiveWorkbook.SaveAs(FileName);
                LExcel.ActiveWorkbook.Close(False);
          finally               
            LExcel.Interactive := True;
            LExcel.IgnoreRemoteRequests := False;
            if LExcel.WorkBooks.Count = 0 then begin
              if not VarIsEmpty(LExcel) then LExcel.Quit;
            end;
            LExcel := Unassigned;
          end;

Stacey.

> -----Original Message-----
> From: Chrissy R [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, 25 October 2001 2:12 p.m.
> To: Multiple recipients of list delphi
> Subject: Re: [DUG]: Export to Excel
> 
> 
> Hi
> 
> > I have a method for opening a new Excel spreadsheet and 
> populating it from 
> > within my app.  This leaves the spreadsheet open and the 
> user then is 
> > responsible for saving it.
> 
> > Does anyone know of a component (cheapware) that will write 
> a dataset 
> > straight out to an Excel format file, without opening Excel.
> 
> > I know there are filters you can get for QR that allow you 
> to export a report 
> > to Excel, but I want to write the pure data without any formatting.
> 
> I am sure you can get the Excel file format and write it 
> directly but you could
> always have a macro in Excel that you called from your app 
> and that saved
> and closed the spreadsheet.
> 
> Chrissy.
> 
> 
> --------------------------------------------------------------
> -------------
>     New Zealand Delphi Users group - Delphi List - 
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED] 
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> 
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to