Results 1 to 2 of 2

Thread: I need a VBS script for reading a text file

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Oct 2001
    Location
    www.alexdata.com
    Posts
    484

    Talking I need a VBS script for reading a text file

    I need a VBS script (a *.vbs file)
    That can read a TXT file in the same folder as the VBSscript is..

    But I could not make it work by using things like:
    Code:
    Open "Test.txt" For Input As #1
      Do While Not EOF(1)
         Line Input #1, s
         strFromFile = strFromFile & s & vbCrLf
      Loop
    Close #1
    msgbox strFromFile
    So then, What must i use inorder to get a VBS to read a txt file
    and read it into a variable, then MSGBOX the variable to the screen.. But its important for it to be put in a variable...
    Cause I will use the variable further on, after reading the file into it...

    and NO, i dont want to make a EXE file, just a VBS script
    ***************
    Please use [highlight=vb] ..your code.. [/highlight] when posting code!

    When you have received the working answer to your question,
    please mark it as *SOLVED* + Your Questions Title ...using your Thread's Tool menu.


    Also try to point out what answer made it work for you, or edit your first post to contain a quote of the correct answer...

    Please Answer All Questions With Working Code Examples...


    My Unfinished Projects and My working Programs
    ***************

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    VBScript needs to use an external object, ie, FileSystemObject, to read files (or to do almost anything useful, for that matter).
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

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