![]() |
FileFormat:=xlTextPrinter saves only 240 characters of cell
Hi, I am using the following code i.e ConvertPC_8ToANSI() to open a DOS based text file and then save it to WINDOWS ANSI text file. My text file contains long records of more than 300 characters, following procedure loads the entire record into one cell and while saving it, it saves only 240 characters and truncates the remaining characters of the cell (record). Any body knows how to come out of this max. character limitation. Thanks in advance! ---------------------------------- Sub ConvertPC_8ToANSI() Dim sFil As String Dim tmpWorkBook As Workbook sFil = "Z:\SOS-DB Pre Migration\PC_8_TO_ANSI\tsf\sample.tsf" Workbooks.OpenText Filename:=sFil, DataType:=xlDelimited, textqualifier:=xlTextQualifierNone, Origin:=xlMSDOS Set tmpWorkBook = ActiveWorkbook tmpWorkBook.SaveAs Filename:=Left(sFil, Len(sFil) - 4) & "_3.tsf", FileFormat:=xlTextPrinter tmpWorkBook.Close End Sub -- srinivasug ------------------------------------------------------------------------ srinivasug's Profile: http://www.excelforum.com/member.php...o&userid=33610 View this thread: http://www.excelforum.com/showthread...hreadid=533885 |
FileFormat:=xlTextPrinter saves only 240 characters of cell
I'm no expert, but here is guess at possible solution inasmuch as no one
else has responded to your inquiry. Can you structure the data retrival using the Right( ) and Left( ) to first retrieve the first 60 characters and then the remaining characters, if there are more than 60? Place the text in adjoining cells and in necessary, use "&" to join at a later point? I would think that you have tried it already in that obviously you are aware of the Right() function. srinivasug wrote: Hi, I am using the following code i.e ConvertPC_8ToANSI() to open a DOS based text file and then save it to WINDOWS ANSI text file. My text file contains long records of more than 300 characters, following procedure loads the entire record into one cell and while saving it, it saves only 240 characters and truncates the remaining characters of the cell (record). Any body knows how to come out of this max. character limitation. Thanks in advance! ---------------------------------- Sub ConvertPC_8ToANSI() Dim sFil As String Dim tmpWorkBook As Workbook sFil = "Z:\SOS-DB Pre Migration\PC_8_TO_ANSI\tsf\sample.tsf" Workbooks.OpenText Filename:=sFil, DataType:=xlDelimited, textqualifier:=xlTextQualifierNone, Origin:=xlMSDOS Set tmpWorkBook = ActiveWorkbook tmpWorkBook.SaveAs Filename:=Left(sFil, Len(sFil) - 4) & "_3.tsf", FileFormat:=xlTextPrinter tmpWorkBook.Close End Sub |
FileFormat:=xlTextPrinter saves only 240 characters of cell
Hi
Excel can only parse 255 characters at a time so if there are more than that then you need to run a routine to parse them all. This could be the problem. For example, something like this is needed. Sp.Shapes("ReturnSlip").Select With Selection .Text = "" For i = 0 To Int(Len(RH) / 255) .Characters(.Characters.Count + 1).Text = Mid(RH, (i * 255) + 1, 255) Next End With I think Chip Pearson explains what to on his help pages. Hope this helps a little. Andrew B srinivasug wrote: Hi, I am using the following code i.e ConvertPC_8ToANSI() to open a DOS based text file and then save it to WINDOWS ANSI text file. My text file contains long records of more than 300 characters, following procedure loads the entire record into one cell and while saving it, it saves only 240 characters and truncates the remaining characters of the cell (record). Any body knows how to come out of this max. character limitation. Thanks in advance! ---------------------------------- Sub ConvertPC_8ToANSI() Dim sFil As String Dim tmpWorkBook As Workbook sFil = "Z:\SOS-DB Pre Migration\PC_8_TO_ANSI\tsf\sample.tsf" Workbooks.OpenText Filename:=sFil, DataType:=xlDelimited, textqualifier:=xlTextQualifierNone, Origin:=xlMSDOS Set tmpWorkBook = ActiveWorkbook tmpWorkBook.SaveAs Filename:=Left(sFil, Len(sFil) - 4) & "_3.tsf", FileFormat:=xlTextPrinter tmpWorkBook.Close End Sub |
All times are GMT +1. The time now is 08:04 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com