I'm working with VFP 9 and Excel 2000. I have the following code working to save an individual worksheet to a file. Is there a better method of doing this?
The following code seems to be a better approach, but it saved the entire workbook. Will this work with the newer versions of Excel.
Always open to suggestions and improvements.
Auguy
Northwest Ohio
Code:
oWorkSheet = oWorkBook.WorkSheets(StaffWsName)
oNewBook = oExcel.WorkBooks.Add
oWorkSheet.Copy(,oNewBook.Worksheets(3)) && Copy sheet 1 after sheet 3
oExcel.DisplayAlerts = .F.
oNewBook.SaveAs ("C:\App\Temp\" + oWorkSheet.Name)
oNewBook.Close
oExcel.DisplayAlerts = .T.
The following code seems to be a better approach, but it saved the entire workbook. Will this work with the newer versions of Excel.
Code:
oWorkSheet.SaveAs ("C:\App\Temp\" + oWorkSheet.Name)
Auguy
Northwest Ohio