Results 1 to 3 of 3

Thread: Read text files?Pls Help

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    singapore
    Posts
    86

    Unhappy Read text files?Pls Help

    How to read a text file in VB. I'm going to access many text files in my VBA program but want to do it neatly. For eg.in my codes, if I have a string named "_APP_PATH" my program shoud access a txt file called "config.txt" and read line by line for the word "_APP_PATH". If it finds it, that means the line below that word is the directory path eg. "C:\windows\desktop\create"...so this string(the path) should be assigned to "_APP_PATH" in my codes...How to doit? Any better way.Attached is how the text file should look like.PLs..I need a solution for it.Pls helpThanks alot.
    Attached Files Attached Files

  2. #2
    I don't do your homework! opus's Avatar
    Join Date
    Jun 2000
    Location
    Good Old Europe
    Posts
    3,863
    Didn't I allready reply to that??

    You can do something loike that (storing data) in an INI-file . Use the API-Calls getprivateprofilestring and writeprivateprofilestrig to do that (neatly)

    Since you are using VBA, why don't you store the data in "parent" file (i.e. the file which holds the VBA-source code).
    You're welcome to rate this post!
    If your problem is solved, please use the Mark thread as resolved button


    Wait, I'm too old to hurry!

  3. #3
    Junior Member
    Join Date
    Feb 2003
    Location
    UK
    Posts
    23
    As opus has already said, using an ini file is what you want. Your description of the text file matches what ini files are intended for.

    Another option is to store it in the registry.

    Either option removes the need for you to parse a text file as the API calls will take care of everything for you.

    Dave

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