Howto: VBScript - Read a file

'-----------------------------------------------------------------------------------
' ReadFileText - Used to read  a file in a folder.
' Parameters:
'   sFile - The file to read
'
' Returns:
'   A string containing the content of the file.
'-----------------------------------------------------------------------------------
Function ReadFileText (sFile)
    Dim objFSO 'As FileSystemObject
    dim oTS
    dim sText
   
    Set objFSO = CreateObject("Scripting.FileSystemObject")

    Set oTS = objFSO.OpenTextFile(sFile)
    sText = oTS.ReadAll

    oTS.close
    set oTS = nothing
    Set objFSO = nothing
 
    ReadFileText = sText
    
end Function