Results 1 to 3 of 3

Thread: [RESOLVED] read entire text file to a variable

  1. #1

    Thread Starter
    Hyperactive Member RS_Arm's Avatar
    Join Date
    Mar 2007
    Location
    Planet Earth
    Posts
    282

    Resolved [RESOLVED] read entire text file to a variable

    Hello guys.

    Can I send to a variable (in one shot) a text file, without doing all that stuff of
    "Do While Not EOF..."?

    Thank you.

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: read entire text file to a variable

    vb Code:
    1. Dim sFileContent As String, hFile As Integer
    2. hFile = FreeFile
    3. Open "c:\theFile.txt" For Input As #hFile
    4.     sFileContent = Input(LOF(hFile), hFile)
    5. Close #hFile

  3. #3

    Thread Starter
    Hyperactive Member RS_Arm's Avatar
    Join Date
    Mar 2007
    Location
    Planet Earth
    Posts
    282

    Re: read entire text file to a variable

    Ok thank you!
    It is just what I wanted.

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