You get that error when you call ReadAll
on an empty file. Check the AtEndOfStream
property and read the content only if it’s false:
If Not file.AtEndOfStream Then fileText = fileText & file.ReadAll
More Related Contents:
- Is it possible to embed and execute VBScript within a batch file without using a temporary file?
- Adding quotes to a string in VBScript
- About using Double quotes in Vbscript
- VBScript — Using error handling
- Recursively access subfolder files inside a folder
- Hide command prompt window when using Exec()
- Cannot use parentheses when calling a Sub Error 800A0414 VBS
- Prevent VBscript app from showing Console Window
- How do I run a VBScript in 32-bit mode on a 64-bit machine?
- Download a file with VBS
- How do I sort arrays using vbscript?
- VBscript code to capture stdout, without showing console window
- ByRef and ByVal in VBScript
- Run Command Line & Command From VBS
- Breaking a String Across Multiple Lines
- ADODB.Parameters error ‘800a0e7c’ Parameter object is improperly defined. Inconsistent or incomplete information was provided
- What does the “On Error Resume Next” statement do?
- VBScript to send email without running Outlook
- How to set delay in vbscript
- How to find the window Title of Active(foreground) window using Window Script Host
- How to identify between ok and cancel button in inputbox
- Use clipboard from VBScript
- How do I include a common file in VBScript (similar to C #include)?
- How can I show a message box with two buttons?
- How can I convert a VBScript to an executable (EXE) file? [closed]
- VBS with Space in File Path
- MSGbox in VBS that updates with value of variable
- insert a variable to cmd command
- How can I use the common Save As dialog from VBScript?
- Is the Sleep operation no longer used in VBscript?