how to check through Access whether some Excel file is opened

A

Alex

I would appreciate if any body could advise how to check
through Access whether some Excel file is opened.

Thanks advance
 
I

Immanuel Sibero

Hi Alex,

I use the function below, I wish I remembered where I found it so I could
give proper credit....




Function FileLocked(strFileName As String) As Boolean
On Error Resume Next

Open strFileName For Binary Access Read Lock Read As #1
Close #1

If Err.Number <> 0 Then
FileLocked = True
Err.Clear
End If

End Function






HTH,
Immanuel Sibero
 
A

Alex

Thank you very much
-----Original Message-----

Hi Alex,

I use the function below, I wish I remembered where I found it so I could
give proper credit....




Function FileLocked(strFileName As String) As Boolean
On Error Resume Next

Open strFileName For Binary Access Read Lock Read As #1
Close #1

If Err.Number <> 0 Then
FileLocked = True
Err.Clear
End If

End Function






HTH,
Immanuel Sibero





.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top