C
Charles A. Lackman
Hello,
I have been able to successfully make an Excel file from data I have in a
dataset, IE:
With Excel
..SheetsInNewWorkbook = 1
..Workbooks.Add(1)
..Worksheets().Select()
For intRow = 0 To FedExDataset.Tables("Order").Rows.Count - 1
For intColumnValue = 0 To FedExDataset.Tables("Order").Columns.Count - 1
..Cells(intRow + 1, intColumnValue + 1).Value =
FedExDataset.Tables("Order").Rows(intRow).ItemArray(intColumnValue).ToString
Next
Next
strExcelFile = "C:\Customers\" & TheFileName
..ActiveWorkbook().SaveAs(strExcelFile)
..ActiveWorkbook.Close()
Exit Sub
What I am trying to do is make the file into a CSV.
".ActiveWorkbook().SaveAs(strExcelFile)" has a parameter for fileformat, but
i cannot get it to work properly. IE:
Dim TheFormat As New Excel.XlFileFormat
TheFormat = Excel.XlFileFormat.xlCSV
..ActiveWorkbook().SaveAs(strExcelFile, TheFormat)
Any Suggestions??
Thanks,
Chuck
I have been able to successfully make an Excel file from data I have in a
dataset, IE:
With Excel
..SheetsInNewWorkbook = 1
..Workbooks.Add(1)
..Worksheets().Select()
For intRow = 0 To FedExDataset.Tables("Order").Rows.Count - 1
For intColumnValue = 0 To FedExDataset.Tables("Order").Columns.Count - 1
..Cells(intRow + 1, intColumnValue + 1).Value =
FedExDataset.Tables("Order").Rows(intRow).ItemArray(intColumnValue).ToString
Next
Next
strExcelFile = "C:\Customers\" & TheFileName
..ActiveWorkbook().SaveAs(strExcelFile)
..ActiveWorkbook.Close()
Exit Sub
What I am trying to do is make the file into a CSV.
".ActiveWorkbook().SaveAs(strExcelFile)" has a parameter for fileformat, but
i cannot get it to work properly. IE:
Dim TheFormat As New Excel.XlFileFormat
TheFormat = Excel.XlFileFormat.xlCSV
..ActiveWorkbook().SaveAs(strExcelFile, TheFormat)
Any Suggestions??
Thanks,
Chuck