title: FileSystemObject FileExists works on one computer but not another
body: <p>In Excel 2010 VBA, I'm using the FileExists property of the FileSystemObject to check whether a file exists. On my computer it works fine. But on another Excel 2010 computer, it reports that the file is not there when in fact we see in Windows Explorer that the file is there. In both cases, the file being checked is on the local hard drive.</p>
  
  <p>I'm checking for the file right after using Shell to unzip the file. I use DoEvents after the unzip. The file is being extracted to the same folder that the zip file is in.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>Dim oShell As Object, oZippedFile As Object, oUnzipTargetFolder As Object
  Dim FSO As Object, oFile As Object, oFolder As Object
  Dim strZipfileFullpath As Variant, strTargetFolderpath As Variant, strTargetFullpath As Variant 'NOT AS STRINGS!! (Shell error if strings)
  Dim bFileCheckFsoFileExist As Boolean
  
  Set oShell = CreateObject("shell.application")
  Set FSO = CreateObject("scripting.filesystemobject")
  
  strZipfileFullpath = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", MultiSelect:=False)
  
  Set oFile = FSO.GetFile(strZipfileFullpath)
  Set oFolder = oFile.ParentFolder
  strTargetFolderpath = oFolder.Path &amp; Application.PathSeparator
  strTargetFullpath = strTargetFolderpath &amp; oShell.Namespace(strZipfileFullpath).Items.Item(0).Name
  
  oShell.Namespace(strTargetFolderpath).CopyHere oShell.Namespace(strZipfileFullpath).Items.Item(0) 'this zip has only one file.
  DoEvents
  
  bFileCheckFsoFileExist = FSO.FileExists(strTargetFullpath)
  </code></pre>
  
  <p>Any ideas why this works fine on one computer, but on another computer reports that the file is not there even though it we see that it clearly is?</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>I thought I'd add this note in case it may be helpful for others running into the same snag.</p>
  
  <p>The basic underlying issue was that when using Shell to extract a zipped file, the Name property of the zipped file object does not include the extension If Windows Explorer is hiding extensions and the file has a registered extension. For example:</p>
  
  <pre><code>Dim strGofnZipfileFullpath As Variant
  Dim oShell As Object, oShellZipfile As Object, oShellZippedFileInZipfile As Object
  Dim strShellZippedFileInZipfileFilename As Variant 'NOT AS STRINGS!! (Shell error if strings)
  
  strGofnZipfileFullpath = Application.GetOpenFilename(filefilter:="Zip Files (*.zip), *.zip", MultiSelect:=False)
  
  Set oShell = CreateObject("shell.application")
  Set oShellZipfile = oShell.Namespace(strGofnZipfileFullpath)
  Set oShellZippedFileInZipfile = oShellZipfile.Items.Item(0) 'assumes only 1 file in zip. 
          strShellZippedFileInZipfileFilename = oShellZippedFileInZipfile.Name
  </code></pre>
  
  <p>If Windows Explorer is set to hide extensions and the zipped file has a registered extension, strShellZippedFileInZipfileFilename does not include the extension.</p>
  
  <p>However, the zipped file object (oShellZippedFileInZipfile) also has a Path property which does include the extension. So you can get the filename including extension like this:</p>
  
  <pre><code>strShellZippedFileInZipfileFilename = Right(oShellZippedFileInZipfile.Path, InStr(StrReverse(oShellZippedFileInZipfile.Path), Application.PathSeparator) - 1)
  </code></pre>