Hello,
I have an Excel spreadsheet that I need to save as a CSV file, I wonder if this is doable from within VFP?
I output the spreadsheet from within VPF and then run a routine to change the column headers and width, that all works fine, but I can't figure out how to tell VPF to save as a CSV, here is the code I have:
oExcel = CREATEOBJECT("Excel.Application")
oWorkBook=oExcel.Workbooks.Open("P:\InventoryFeed\inventory.xls")
oExcel.Cells(1,1).Value = "StockCode"
oExcel.Cells(1,2).Value = "In-Stock"
oExcel.Cells(1,3).Value = "Kit"
oExcel.Columns.AutoFit()
oWorkbook.Save()
oWorkbook.SaveAs("P:\InventoryFeed\inventory.csv","xlText")
oWorkbook.Close()
RELEASE oWorkbook
RELEASE oExcel
I have tried many different ways to format the SaveAs command, but none work.
I will greatly appreciate your help.
Mike.
I have an Excel spreadsheet that I need to save as a CSV file, I wonder if this is doable from within VFP?
I output the spreadsheet from within VPF and then run a routine to change the column headers and width, that all works fine, but I can't figure out how to tell VPF to save as a CSV, here is the code I have:
oExcel = CREATEOBJECT("Excel.Application")
oWorkBook=oExcel.Workbooks.Open("P:\InventoryFeed\inventory.xls")
oExcel.Cells(1,1).Value = "StockCode"
oExcel.Cells(1,2).Value = "In-Stock"
oExcel.Cells(1,3).Value = "Kit"
oExcel.Columns.AutoFit()
oWorkbook.Save()
oWorkbook.SaveAs("P:\InventoryFeed\inventory.csv","xlText")
oWorkbook.Close()
RELEASE oWorkbook
RELEASE oExcel
I have tried many different ways to format the SaveAs command, but none work.
I will greatly appreciate your help.
Mike.