Results 1 to 5 of 5

Thread: [RESOLVED] Extra Line When Using Open... For Output

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Resolved [RESOLVED] Extra Line When Using Open... For Output

    Is there any way to prevent VB from adding an extra line after writing text like this:
    VB Code:
    1. Open App.Path & "\Test.txt" For Output As #1
    2. Print #1, "My Text Is Here, But A Line Will Be Inserted After It"
    3. Close #1
    When I use something like the above code, an extra line is inserted after that text, but I dont want it to be there. Any Suggestions?
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Extra Line When Using Open... For Output

    Sure: A semi-colon supresses line-feeds.

    VB Code:
    1. Open App.Path & "\Test.txt" For Output As #1
    2. Print #1, "My Text Is Here, But A Line Will Be Inserted After It"[COLOR=Red];[/COLOR]
    3. Close #1

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Extra Line When Using Open... For Output

    thanx dglienna, I'll check it out as soon as I get my code working again...
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

  4. #4
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Extra Line When Using Open... For Output

    Note that if you later open the file for Append and Print some text, it will be written onto the first line.

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2005
    Location
    South Africa
    Posts
    760

    Re: Extra Line When Using Open... For Output

    Works brilliantly, thanx again dglienna!
    If I helped you out, please consider adding to my reputation!

    -- "The faulty interface lies between the chair and the keyboard" --

    VB6 Programs By Me:
    ** Dictionary, Thesaurus & Rhyme-Generator In One ** WMP Recent Files List Editor ** Pretty Impressive Clock ** Extract Firefox History **

Posting Permissions

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



Click Here to Expand Forum to Full Width