FUNCTION _ExcelSaveSheeet LPARAMETERS tcOriginal, tcSaveAs, tcSheet oExcel = CREATEOBJECT('excel.application') oExcel.WorkBooks.Open(tcOriginal) oExcel.ActiveWorkbook.WorkSheets(tcSheet).SaveAs(tcSaveAs) WITH oExcel.ActiveWorkbook .Application.DisplayAlerts = .F. FOR each oSheet in .WorkSheets IF oSheet.Name # tcSheet oSheet.Delete ENDIF ENDFOR .Application.DisplayAlerts = .T. .Save ENDWITH oExcel.Quit()But wait there is a faster one (VFP is faster than Excel right ?)
FUNCTION _ExcelSaveSheeet LPARAMETERS tcOriginal, tcSaveAs, tcSheet COPY file (tcOriginal) to (tcSaveAs) oExcel = CREATEOBJECT('excel.application') oExcel.WorkBooks.Open(tcSaveAs) WITH oExcel.ActiveWorkbook .Worksheets(tcSheet).Activate .Application.DisplayAlerts = .F. FOR each oSheet in .Worksheets IF oSheet.Name # tcSheet oSheet.Delete ENDIF ENDFOR .Application.DisplayAlerts = .T. .Save ENDWITH oExcel.Quit()Cetin