Consulting

Results 1 to 9 of 9

Thread: Solved: Export to Text File

  1. #1
    VBAX Tutor gnod's Avatar
    Joined
    Apr 2006
    Posts
    257
    Location

    Question Solved: Export to Text File

    Hi,

    how can i export the worksheet (Sheet1) to text file using the restriction/rules in "Txt Layout" sheet.. In column G, this is the corresponding column in Sheet1.. some data is constant in the text file.. pls refer to the attach file.. if the data in the worksheet exceed the field length, it will only get the number of digits/characters provided in that field (for example, if the field length is 35 characters, only 35 characters will be shown and others will be drop)..


    Thanks..

  2. #2
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    I don't think you can do that kind of formatting in a text file.....maybe I misunderstand the problem.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  3. #3
    VBAX Tutor gnod's Avatar
    Joined
    Apr 2006
    Posts
    257
    Location
    isn't possible
    all i want is to put the data coming from excel to text file in their proper position, for example the voucher number will start on the 11th character position and should be 10 digits only..

  4. #4
    Moderator VBAX Wizard lucas's Avatar
    Joined
    Jun 2004
    Location
    Tulsa, Oklahoma
    Posts
    7,323
    Location
    Quote Originally Posted by gnod
    Hi,

    how can i export the worksheet (Sheet1) to text file using the restriction/rules in "Txt Layout" sheet.. In column G
    Sorry, I misunderstood your request based on this sentence.
    Steve
    "Nearly all men can stand adversity, but if you want to test a man's character, give him power."
    -Abraham Lincoln

  5. #5
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,284
    Location
    For the voucher number use mid function to determine number of positions to export (start, lenght of characters to export) if > 11

    --- why not using a delimiter ? when voucher is less than 11, do you have to add a certain number of spaces or zeros to get 11 characters ? ---

    Charlize

  6. #6
    VBAX Tutor gnod's Avatar
    Joined
    Apr 2006
    Posts
    257
    Location
    Quote Originally Posted by Charlize
    For the voucher number use mid function to determine number of positions to export (start, lenght of characters to export) if > 11

    --- why not using a delimiter ? when voucher is less than 11, do you have to add a certain number of spaces or zeros to get 11 characters ? ---
    Charlize
    the txt layout sheet if the format of the text file.. voucher number is 10 digits only. if it is less than 10 then it must be padded with zeroes (refer to the txt layout sheet)..

    if you run the sub procedure "ExportToTextFile", it already created the text file but the problem is i must comply with the position format in the text file..

  7. #7
    VBAX Tutor gnod's Avatar
    Joined
    Apr 2006
    Posts
    257
    Location
    does anyone know how to do this..
    Thanks..

  8. #8
    VBAX Master
    Joined
    Jul 2006
    Location
    Belgium
    Posts
    1,284
    Location
    Have you tried this kb article : http://vbaexpress.com/kb/getarticle.php?kb_id=759

    Charlize

  9. #9
    VBAX Tutor gnod's Avatar
    Joined
    Apr 2006
    Posts
    257
    Location

    Smile

    Charlize,

    thanks.. this is the one i'm looking for..

Posting Permissions

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