Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default opening a shared workbook

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, to the
message would be both inappropriate and confusing...)

in the past I've used this procedure, but the workbook was NOT SHARED (since
it is now shared, it would be possible to get an "is open" response even
though it was not so 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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
shared workbook - shared workbook options grayed out Edward Letendre Excel Discussion (Misc queries) 0 March 3rd 10 10:47 PM
Slow Opening Shared Workbook SteveH New Users to Excel 1 July 26th 09 11:18 PM
Shared workbook - opening to the correct worksheet beata Excel Discussion (Misc queries) 0 January 28th 08 04:45 PM
Printing viewing a shared workbook on a shared drive aloomba Excel Discussion (Misc queries) 0 April 13th 07 02:52 PM
update pivot in shared shared workbook 00George00 Excel Discussion (Misc queries) 1 August 23rd 06 08:16 PM


All times are GMT +1. The time now is 08:45 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"