Results 1 to 5 of 5

Thread: Create, Edit, and Rename text file

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Location
    Martin County , FL
    Posts
    153

    Create, Edit, and Rename text file

    I need to create a text file out of nothing. How? Once that is created in a certain directory i want some variables placed in the file then have it renamed to a... .info i need to know how to create the text file then how to rename it. I know that you rename it using 'for' and 'as' but i dont know exactly how. THX

  2. #2
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    Why does it need to be a txt file first, then renamed? Just use the following code:
    VB Code:
    1. Open App.Path & "\myfile.info" For Output As #1
    2.     Print #1, myVar1
    3.     Print #1, myVar2
    4. Close #1
    <removed by admin>

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2001
    Location
    Martin County , FL
    Posts
    153
    Problems with Quotes I have a line with quotes inside of it. It's XML. How do i deal with that. It also has variables within it. What would i need to do to fix this. It ends the quote on the second " can i use ( or { or [ s?

  4. #4
    PowerPoster MidgetsBro's Avatar
    Join Date
    Oct 2000
    Location
    Apparently, Internet.com
    Posts
    3,125
    I don't quite understand what you mean. To use quotes in a string you can either use """ triple quotes, I think, or the way I do it: SomeStringVar & Chr(34) & "SomeMoreText" & Chr(34). The Chr(34) is a " character.
    <removed by admin>

  5. #5
    PowerPoster cafeenman's Avatar
    Join Date
    Mar 2002
    Location
    Florida
    Posts
    2,819
    If there are quotes in the string you read from a file then the file was written using Write instead of Print.
    VB Code:
    1. Write #1, "NewHelp4Me"
    2. Print #1, "NewHelp4Me"

    In the first case the file will be like this:

    "NewHelp4Me"

    In the second case the file will be like this:

    NewHelp4Me

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