A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
It is obvious that the server / windows locks that file. Maybe it is a similar issue as the "access denied" when you try to copy and rename a folder.
Windows 7 creates thumbs.db files while browsing network folders. So if you copy a folder on a network drive, Windows 7 creates the thumbs.db file in the background and locks that folder until the creation is done. Sounds fast, but on networks drives it can take a while. If it tried to delete the copied folder immediately, I got always an access denied. But when I browse the folder it was empty!
In fact the folder isn't empty, there is a thumbs.db in that folder and this file is the reason.
Follow this steps to disable the thumbs.db on network folders:
- Open your registry editor.
- Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\
- If key “Explorer” doesn’t exists create a key named “Explorer”
- In key “Explorer” create a new DWORD 32 bit value named “DisableThumbsDBOnNetworkFolders” with value = 1
- Reboot your system
If that doesn't work, try to open the file readonly:
Workbooks.Open "Y:\InvoiceLog\Exports\apptexport.csv", ReadOnly:=True
If you need to write into that file, check if the file is closed before you open the file.
Andreas.
PS.: I'm on vacation the next 3 weeks, an answer may take a while.
Function IsOpen(ByVal FileName As String) As Boolean
'True if FileName is open
Dim slot As Integer
If Dir(FileName) <> vbNullString Then
On Error Resume Next
slot = FreeFile
Open FileName For Binary Access Read Lock Read As #slot
IsOpen = Err.Number <> 0
Close #slot
Else
IsOpen = False
End If
End Function