This is the Code which i wrote to export records to CSV file Format, Which then eventually opens in Excel.
[CODE]
If F.FileExists("C:\file1.csv") = True Then
F.DeleteFile "C:\file1.csv", True
End If
Set F1 = F.OpenTextFile("C:\file1.csv", ForWriting, True, TristateFalse)
F1.WriteLine "Delivered Bills "
F1.WriteLine "Date,Bill No,Delivered To,Relation,Contact No,Delivery Time"
F1.WriteLine
F1.WriteLine RSTemp.GetString(adClipString, , ",")
F1.Close
Set F1 = Nothing
MsgBox "File Exported to C:\file1.csv", vbInformation, "Info"
[CODE]
But when I open it with Excel, It opens in a single Sheet and has limits 65536 rows.
My Question is how to go about exporting the CSV file to open in Multiple Sheets .
I want to do it without using Excel Object, (beacuse if Ecel is not found in the Client Machine !)
Sorry, RajWolf, even if you address me directly, I have to admit that I'm not an expert with Excel sheets.
As I look at your code I don't even understand how it could export anything from an excel-file.
I'd try to use Excel to export a .csv file first. Multi sheet of course. Then I'd examine the file. The .csv format is readable ASCII, so any information for multiple sheets will be seen. Maybe you have to add lines to create such info in your export function...
Maybe it becomes clearer if you could provide a sample .csv file you have created with Excel and which you have tried to reimport successfully.
EXCEL : has limits... Noticably - 255 columbs and 65535 rows... (per sheet) more specifically in Hex it has HFF col & HFFFF rows...
You can not exceed this at all, and excel simly dumps the extra with a warning...
CSV : Is a raw data format.. It does NOT have ANY commands that can be placed in it...
With this in mind, All that you can do is to check your CSV output and trim it to 65534 rows of data and then write the rest into a second file (again checking for file length)...
There after you can write a script in excell to import the files into seperate sheets of a single workbook...
I've done plenty of work with CSV and Excel and can assit you with this...
CSV : Is a raw data format.. It does NOT have ANY commands that can be placed in it...
EXCEL : has limits... Noticably - 255 columbs and 65535 rows... (per sheet) more specifically in Hex it has HFF col & HFFFF rows...
Yes , I tried, you all are correct.
What i was trying to do is export data in .CSV that the client user will be able to open it in Excel if he has or Open Office if he has. Then the Multiple Sheets problem Occured.
I was mistaking CSV files but as said by GremlinSA .CSV is a raw data format.
Thanks a lot for the HELP for now I know that it is not possible with .CSV files
I think now I should export limited records and let the user do the management of the sheets.
You can export directly to excel sheet in an xls file by using the access oledb driver. It supports all kinds of file formats besides just the access mdb type. Check it out. You should be able to create a multiple sheet xls file that can be opened by excel and by open office.
Bookmarks