'=========================================================== Function zFile_ReadString(sFileName) 'This function reads the entire contents of a file into a string 'An empty string is returned if the file is empty or if the file does not exist 'Example of Usage: ' sFile = zFile_ReadString("c:\file.txt") Print "zFile_ReadString: " & sFileName Dim oFso, oFile Const ForReading = 1, ForWriting = 2, ForAppending = 8 Set oFso = CreateObject("Scripting.FileSystemObject") If oFso.FileExists(sFileName) Then 'Open the file for reading Set oFile = oFso.openTextFile(sFileName, ForReading) 'Read ALL from the file and return it from the function zFile_ReadString = oFile.ReadAll 'Close the file oFile.Close Set oFile = Nothing Else Print "File_ReadString - File NOT found: " & sFileName 'Return nothing from the function zFile_ReadString = "" End If Set oFso = Nothing End Function '===========================================================