+ Reply to Thread
Results 1 to 4 of 4

FileFormat:=xlTextPrinter saves only 240 characters of cell

  1. #1
    Registered User
    Join Date
    04-18-2006
    Posts
    3

    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

  2. #2
    windsurferLA
    Guest

    Re: 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
    >
    >


  3. #3
    Andrew B
    Guest

    Re: 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
    >
    >


  4. #4
    Registered User
    Join Date
    02-14-2021
    Location
    Coimbra
    MS-Off Ver
    19
    Posts
    1

    Re: FileFormat:=xlTextPrinter saves only 240 characters of cell

    search in google:
    "Formatted text (.prn) is limited to 240 characters per line in Excel"
    and see what's down there

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1