title: vbscript how to check if txt file exists and whe not create empty one
body: <p>How can i check with vbscript if the txt file in C:\Temp\CAD_Kunde.txt exists and when it does not exist it should be empty created.</p>
  
  <p>Edit:
  I get an error (Expected Statement on Line 11 Char 1 when i use this:</p>
  
  <pre><code>   &lt;SCRIPT Language="VBScript"&gt; 
          Sub Window_OnLoad
   //Line 11 is the one below:
      Option Explicit  
      Dim oFSO, oTxtFile   
      Set oFSO = CreateObject("Scripting.FileSystemObject")     
      If oFSO.FileExists("C:\Temp\CAD_Kunde.txt")  then
             Msgbox "File Exist" 
      Else 
            Set oTxtFile = oFSO.CreateTextFile("C:\Temp\CAD_Kunde.txt")  
            Msgbox "File Created" 
      End If 
  
      End Sub
      &lt;/script&gt;
  </code></pre>