View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
keepITcool keepITcool is offline
external usenet poster
 
Posts: 2,253
Default error number to determine if shared file is open on "this" machine


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


"mark kubicki" wrote:

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