#1   Report Post  
Junior Member
 
Location: Maine, USA
Posts: 8
Send a message via Yahoo to mainemike
Post CSV export help

I have a General format column. One of the cells is 359 characters in length. When I export the column using..

ActiveWorkbook.SaveAs Filename:=NFName, FileFormat:=xlCSV, CreateBackup:=False

and then when I open the .csv file, the cell is truncated to 255. Even changing the format to Text, I still only have 255 characters.

I did try to import the data directly from the workbook into Access, but I ran into the 255 character problem too. I was told that exporting the worksheets to CSV prior to importing them into Access would allow me to get the full 359 vs 255, but that's proving not to be correct. The problem seems to be pointing to Excel and not Access as the limiting factor.

Is there some other file or cell format that would allow me to export the entire contents? I need to eventually import the data into Access, and I do have headers. CSV is one of the easier formats I've found to do this with.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default CSV export help

I just tried this with a few cells filled with 500 character strings.

I saved it as a .csv file and opened that .csv file in a text editor. The
string lengths were what they were supposed to be (500 characters each).

I reopened the .csv file in excel and those cells still contained strings of 500
characters.


Ahhhhhhh.

Part of the code that you didn't share was a command that copied the worksheet
to a new workbook--so you could save from there, right?

If that's true, then that's what caused the trouble.

If you did that same copying of a worksheet (with strings 255), you'd get a
warning message. Using code won't cause the warning.

The easiest way to overcome this problem is to copy the sheet, copy and paste
the cells, then do the file|saveAs.

Dim wksToCopy As Worksheet
Dim NewWks As Worksheet

Set wksToCopy = Worksheets("sheet1")

wksToCopy.Copy
Set NewWks = ActiveSheet

wksToCopy.Cells.Copy _
Destination:=NewWks.Range("a1")

With NewWks
.Parent.saveas filename:=..., fileformat:=xlcsv, ...
.Close savechanges:=False
End With




mainemike wrote:

I have a General format column. One of the cells is 359 characters in
length. When I export the column using..

ActiveWorkbook.SaveAs Filename:=NFName, FileFormat:=xlCSV,
CreateBackup:=False

and then when I open the .csv file, the cell is truncated to 255. Even
changing the format to Text, I still only have 255 characters.

I did try to import the data directly from the workbook into Access,
but I ran into the 255 character problem too. I was told that
exporting the worksheets to CSV prior to importing them into Access
would allow me to get the full 359 vs 255, but that's proving not to be
correct. The problem seems to be pointing to Excel and not Access as
the limiting factor.

Is there some other file or cell format that would allow me to export
the entire contents? I need to eventually import the data into Access,
and I do have headers. CSV is one of the easier formats I've found to
do this with.

--
mainemike


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting data in a table from excel export Secret Squirrel Excel Discussion (Misc queries) 0 February 9th 06 02:21 AM
Can't export actual text - Get #### instead confuzedagain Excel Discussion (Misc queries) 2 December 7th 05 04:31 PM
How do I export data from Excel into an ODBC client / or plain tex Margaret Excel Discussion (Misc queries) 2 February 15th 05 09:51 PM
Export to fixed width text file FinChase Excel Discussion (Misc queries) 0 January 24th 05 07:25 PM
How do I get data (tables) from IE to export to an EXCEL sreadshee WebgirlMD Excel Discussion (Misc queries) 2 January 19th 05 08:41 PM


All times are GMT +1. The time now is 10:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"