Hoja.Range['A' + inttostr(i+5),'A' + inttostr(i+5)].Activate;
Hoja.PivotTableWizard(xlDatabase, 'A5:AL' + inttostr(i-4),'REPORTE',
'TablaDin', EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, EmptyParam, EmptyParam, EmptyParam,
EmptyParam, lcid);
GD := Whoja.PivotTables('TablaDin', lcid) as PivotTable;
GD.AddFields('A','C','AL', EmptyParam);
(GD.PivotFields('AVERAGE(AL)') as PivotField).Orientation := xlDatafield;
end;
RenombrarArchivo();
if not DirectoryExists('C:\Reportes\') then CreateDir('C:\Reportes\');
if not DirectoryExists('C:\Reportes\Inyeccion\') then CreateDir('C:\Reportes\Inyeccion\');
Excel.ActiveWorkbook.SaveAs( ExtractFilePath( 'C:\Reportes\Inyeccion\' ) + 'ReporteOEE-Inyec.xlsx',EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, xlNoChange, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, 0);
ShowMessage('Reporte Guardado en C:\Reportes\Inyeccion\');
Excel.Visible[1]:=true;
Excel.Quit;
end;