Problem with overriding files with macro

I have a macro that saves PDF files for each sheet in my drawing.  I'm having a problem with it if it tries to save over an existing file with the same name.  I think it may be an issue with Windows, but I'm not really sure what is happening.  Here is the section of code that deals with saving my files:

<p>        'Check if existing file can be overridden<br>            On Error Resume Next  'Skip file deletion on error<br>            oFSO.DeleteFile strNewPath & strNewFileName  'Delete existing file<br>            On Error GoTo 0  'Disable error handler<br>            <br>            If oFSO.FileExists(strNewPath & strNewFileName) = True Then  'Check if file was deleted<br>            'Message user that existing file can not be overridden<br>                swApp.SendMsgToUser2 "Unable to override existing file. (" & strNewFileName & ")", swMbStop, swMbOk<br>                Debug.Print "**Unable to override existing file (" & strNewFileName & ")**"<br>            Else  'If file was deleted<br>            'Set Sheet to export<br>                bStatus = swExportPDFData.SetSheets(swExportData_ExportSpecifiedSheets, strSheetName)<br>                <br>            'Save Sheet as PDF<br>                swModel.Extension.SaveAs strNewPath & strNewFileName, swSaveAsCurrentVersion, _<br>                    swSaveAsOptions_UpdateInactiveViews, swExportPDFData, lngErrors, lngWarnings<br>                <br>                If lngErrors = 0 Then  'Check if error occured during save<br>                    Debug.Print "      New File Name: " & strNewFileName </p><p>                'Add new filename to list of new files</p><p>                    frmNewFiles.lboFiles.AddItem strNewFileName</p><p>                Else  'If error occured<br>                'Send error message to User<br>                    swApp.SendMsgToUser2 "Error occured on sheet """ & vSheets(i) & """." _<br>                        & vbCrLf & "No file created.", swMbWarning, swMbOk<br>                End If<br>            End If</p>

When it gets to the first IF statement, the macro will sometimes see the file as deleted, even though I can see that the file still exists in Windows Explorer.  The "SaveAs line gets run with no errors, so no messages ever go to the user that the file was not saved correctly.  Looking in Windows Explorer, the original file is still there.

This doesn't happen everytime that I file needs to be overridden.  Most of the time, the macro works as expected.  I have tried some different things out, and it seems to mostly occur when the file has been opened and closed shortly before the macro is run.  It also only seems to occur if Windows Explorer is currenly open to the folder that holds the file to be replaced.

Could this have something to do with Windows 7 caching or indexing the file at the same time the macro is running?  Why isn't the FileExists code recognizing that the file still exists?

SolidworksApi macros