Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
checking to see if a "shared" workbook is already open
I want to check if a SHARED workbook is open (on the user's machine), so
that I can run code to open it if it is not (otherwise I would get a message about opening an already open ... ) the workbook is HIDDEN to the user, so the message would be both inappropriate and confusing... in the past I've used this procedure, and it worked fine, but the workbook was NOT SHARED currently i'm getting a errornum 0 (indicating the file is not open) even though it is open (on the user's machine): Function IsFileOpen(filename As String) Dim filenum As Integer, errnum As Integer On Error Resume Next filenum = FreeFile() Open filename For Input Lock Read As #filenum Close filenum errnum = Err On Error GoTo 0 Select Case errnum Case 0 IsFileOpen = False Case 70 IsFileOpen = True Case Else Error errnum End Select End Function it was suggested that I check for the workbooks status, but that doesn't tell me if it is "open" on the user's machine (only if is shared or exclusive...) 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") thanks in advance, mark |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to Activate "Show all" in a Protected Shared Workbook | Excel Discussion (Misc queries) | |||
Shared Workbook is "locked for editing" | Excel Worksheet Functions | |||
"Shared Workbook" seems to deactivate features like macros | Excel Discussion (Misc queries) | |||
Shortcut key for "Paste Options" and "Error Checking" buttons? | Excel Discussion (Misc queries) | |||
error number to determine if shared file is open on "this" machine | Excel Programming |