+ Reply to Thread
Results 1 to 2 of 2

Writing text to a file

  1. #1
    Registered User
    Join Date
    09-07-2010
    Location
    Allendale, MI
    MS-Off Ver
    Excel 2003
    Posts
    8

    Writing text to a file

    I need help writing to a txt file. I would like to write a single line that has a variety of words and variables. Here is what I have. & descrip is a variable and I want to write it's value to the text file. How do you add more text and variables on the same line? I keep getting "expecting separator" errors.

    Please Login or Register  to view this content.

    Also say I wanted to place a tab before the word "Layer", what is the command for that?

    Thanks!
    Last edited by Leith Ross; 09-08-2010 at 08:09 PM. Reason: Added Code Tags

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Writing text to a file

    Hello fabb2004,

    Since you are late binding the File System Object, you must include all arguments, by position, with their values. You did not set the Create Flag in the OpenTextFile. You don't need to enclose the string value that will be written in parentheses. The tab character has been added to the beginning of the string using a VBA constant..
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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