Ver Mensaje Individual
  #5  
Antiguo 29-12-2004
rruffino rruffino is offline
Miembro
 
Registrado: dic 2004
Ubicación: Berrotaran, Cordoba - Argentina
Posts: 215
Reputación: 20
rruffino Va por buen camino
Aqui va el codigo

Bueno, tal como pediste te pongo el codigo a ver si puedes darme una mano. Espero puedas ayudarme y desde ya mil gracias.-

procedure TForm_excel.BitBtn_bajarClick(Sender: TObject);
var
Excel, Libro: Variant;
i: integer;
Nombre: string;
begin
try
Guardar_planilla.Execute;
if (Guardar_planilla.FileName<>'') then
begin

Excel:=CreateOleObject('Excel.Application');
Excel.Visible := True;
Nombre:=Guardar_planilla.FileName;
Excel.DisplayAlerts:=false;

//Comienzo a llenar las celdas
Excel.WorkBooks.Add();
Excel.WorkBooks[1].WorkSheets[1].Name := 'Reporte';
Libro := Excel.WorkBooks[1].WorkSheets['Reporte'];
DM.IBQuery_cob.SQL.Clear;
DM.IBQuery_cob.SQL.Add('select * from cobranza where periodo='+intToStr(DM.IBDataSet_periodoID_PERIODO.Value)+'order by fecha');
DM.IBQuery_cob.Open;
DM.IBQuery_cob.First;
i:=1;
while not (DM.IBQuery_cob.Eof) do
begin
Libro.Cells [i,1] := DM.IBQuery_cobFECHA.Value;
Libro.Cells [i,2] := DM.IBQuery_cobCONCEPTO.Value;
i:=i+1;
DM.IBQuery_cob.Next;
end;
DM.IBQuery_cob.Close;
//Acá es donde salta el error de que no soporta este metodo pero no hallo otro
Excel.SaveAs(Nombre,Null,Null,Null,false,false,xlNoChange,xlUserResolution,false,Null,Null,0);
end;
except
Excel.Quit;
showmessage('No se pudo crear el Objecto Excel.');
raise;
end;
end
;
Responder Con Cita