+ Reply to Thread
Results 1 to 2 of 2

Macro Print to file limited the no of character in a row?

  1. #1
    Leslie
    Guest

    Macro Print to file limited the no of character in a row?

    I'm trying to output the contents of the cells in Excel to a txt file with
    the Print # method. But the result is the output is divided into 3 lines. I
    wonder if there is a limit of the no. of character allowed in the txt file
    when using Print # method. The following is my code:

    Print #FNum, vIER; Tab(7); vLPAR; Tab(17); vCHL; Tab(37); vMQM; Tab(49);
    vTYP; Tab(57); vEXT; Tab(58); vOCL; Tab(1058); vOSC; Tab(2058); vEDATE;
    Tab(2088); vTDATE; Tab(2118); vHDATE; Tab(2148); vJDATE; Tab(2178); vSTAT

    Is there any way to print all the contents in a single row? I know it's a
    bit too long (more than 2000 chars), but I have to upload the txt file into
    the AS/400 Database file which I have to get all the data align with the
    predefined format of the table.

    Thanks in advance!!

  2. #2
    Dave Peterson
    Guest

    Re: Macro Print to file limited the no of character in a row?

    Take a look at VBA's help for Tab. You'll see that it uses the "Width #"
    statement. Since Width is limited to 255, I think you should just drop Tab()
    and use Space().

    Print #FNum, vIER; space(7); vLPAR; space(17);.......

    Leslie wrote:
    >
    > I'm trying to output the contents of the cells in Excel to a txt file with
    > the Print # method. But the result is the output is divided into 3 lines. I
    > wonder if there is a limit of the no. of character allowed in the txt file
    > when using Print # method. The following is my code:
    >
    > Print #FNum, vIER; Tab(7); vLPAR; Tab(17); vCHL; Tab(37); vMQM; Tab(49);
    > vTYP; Tab(57); vEXT; Tab(58); vOCL; Tab(1058); vOSC; Tab(2058); vEDATE;
    > Tab(2088); vTDATE; Tab(2118); vHDATE; Tab(2148); vJDATE; Tab(2178); vSTAT
    >
    > Is there any way to print all the contents in a single row? I know it's a
    > bit too long (more than 2000 chars), but I have to upload the txt file into
    > the AS/400 Database file which I have to get all the data align with the
    > predefined format of the table.
    >
    > Thanks in advance!!


    --

    Dave Peterson

+ 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