title: Error: Object Required; 'objDIR' Code: 800A01A8
body: <p>Ok Issues I'm having before posting my code...  I'm getting this error </p>
  
  <blockquote>
    <p>Error: Object Required; 'objDIR' Code: 800A01A8 On line 19 </p>
  </blockquote>
  
  <p>When I skip over it using <code>On Error Resume Next and On Error GoTo 0</code> I get <code>Error Object required: 'strFile' Line 22</code> When I skip over that It tells me that my last NEXT is not a collection...  Here's the thing the program worked beautifully Until I added in the steps for getting .tif and .tiff files.  Now even If I remove what I added it doesn't work...</p>
  
  <p>The function of this program is to search a "source directory" for files that are archivable it then moves those files to "Destination Directory" and then checks them as unarchivable so that they aren't picked up a second time around.  It also make a log of what files were copied with date stamps etc.  Like I said it worked great but after tinkering for hours cant figure out what went wrong...</p>
  
  <pre><code>Option Explicit
  
  Dim objLogFile, objFS, strFolder, strDestination, objFolder, eFolder, strFileName,  
  strExtension, objDIR, strFile
  
  Set objFS = CreateObject("Scripting.FileSystemObject")
  strFolder = "S:\Source"
  strDestination = "Z:\Destination"
  Set objFolder = objFS.GetFolder(strFolder)
  Set objLogFile = objFS.OpenTextFile ("S:\Log.txt",2,true)
  
  Go(objFolder)
  
  Sub Go(objDIR)
      objLogFile.Writeline "Script started at " &amp; Now
      If objDIR &lt;&gt; "\System Volume Information" Then
          For Each eFolder In objDIR.SubFolders       
              Go eFolder
          Next
          On Error Resume Next
          For Each strFile In objDIR.Files
              On Error GoTo 0
              strFileName = strFile.Name
              strExtension = objFS.GetExtensionName(strFile)
              If strExtension = "pdf" Then
                  If objFS.GetFile(strFile).Attributes And 32 Then
                      objFS.CopyFile strFile , strDestination &amp; strFileName, True
                      objLogFile.Writeline "Copied " &amp; strFileName &amp; Now
                  Else
                      objFS.GetFile(strFile).Attributes =          objFS.GetFile(strFile).Attributes XOR 32
                  End If
              End If              
              If strExtension = "tif" Then
                  If objFS.GetFile(strFile).Attributes And 32 Then
                      objFS.CopyFile strFile , strDestination &amp; strFileName, True
                      objLogFile.Writeline "Copied " &amp; strFileName &amp; Now
                  Else
                      objFS.GetFile(strFile).Attributes = objFS.GetFile(strFile).Attributes XOR 32
                  End If      
              End If
              If strExtension = "tiff" Then
                  If objFS.GetFile(strFile).Attributes And 32 Then
                      objFS.CopyFile strFile , strDestination &amp; strFileName, True
                      objLogFile.Writeline "Copied " &amp; strFileName &amp; Now
                  Else
                      objFS.GetFile(strFile).Attributes = objFS.GetFile(strFile).Attributes XOR 32
                  End If                  
              End If
          Next  
          objFS.GetFile(strFile).Attributes = objFS.GetFile(strFile).Attributes XOR 32
      End If
      objLogFile.Writeline "Script ended at " &amp; Now
      objLogFile.close
  
      WScript.Quit()
  End Sub
  </code></pre>