Try this function:
Function FileIsOpen(strFile As String) As Boolean
Dim hFile As Long
On Error GoTo OpenError
hFile = FreeFile
Open strFile For Input Lock Read As #hFile
Close #hFile
Exit Function
OpenError:
FileIsOpen = Err.Number = 70
End Function
RBS
"Cresta" <(E-Mail Removed)> wrote in message
news:5F62903B-17B5-4849-9C8F-(E-Mail Removed)...
> Hello all
> Is there any way to check if a file is already open by another user before
> trying to open it.
>
> If "Filename is open" = true then
> abort procedure
> else
> Workbooks.Open Filename....
> end if
>
> Thanks
|