error number to determine if shared file is open on "this" machine

M

mark kubicki

i've change the way a file is used: it is now shared...
so, this code which had been useful... no longer detects if a file is
currently open on "this" computer

what would the correct error number be?

Select Case errnum
' No error occurred.
' File is NOT already open by another user.
Case 0
IsFileOpen = False
' Error number for "Permission Denied."
' File is already opened by another user.
Case 70
IsFileOpen = True
' Another error occurred.
Case Else
Error errnum
End Select

thanks in advance
mark
 
K

keepITcool

you'll need to check workbook.userstatus

try like:

Private Sub Workbook_Open()

Dim vMode
On Error Resume Next
If Me.ReadOnly Then
vMode = 3
Else
vMode = Application.VLookup(Application.UserName, Me.UserStatus, 3)
End If
MsgBox "Mode: " & Choose(vMode, "exclusive", "shared", "readonly")

End Sub



keepITcool

< email : keepitcool chello nl (with @ and .) >
< homepage: http://members.chello.nl/keepitcool >
 

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