View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Andy Pope Andy Pope is offline
external usenet poster
 
Posts: 2,489
Default Determine if a workbook is shared

Hi Dick,

How about using the MultiUserEditing property?

Function IsShared(Bookname As String) As Boolean
IsShared = Workbooks(Bookname).MultiUserEditing
End Function

Cheers
Andy

Dick Kusleika wrote:

quartz

The only way I know is to check the Title bar for [Shared]. The problem is
that if the ActiveWindow is not maximized with Excel, [Shared] doesn't show
up there - and, for some reason, it doesn't show up in ActiveWindow.Caption
either. I came up with maximizing the ActiveWindow, reading the title bar
and checking for [Shared]. Also, you can't turn off ScreenUpdating because
the title bar won't update. Here's what I have:

Sub CheckShared()

Dim OldState As XlWindowState
Dim Msg As String

OldState = ActiveWindow.WindowState

ActiveWindow.WindowState = xlMaximized

If InStr(1, Application.Caption, "[Shared]") 0 Then
Msg = ActiveWorkbook.Name & " is shared"
Else
Msg = ActiveWorkbook.Name & " is not shared"
End If

ActiveWindow.WindowState = OldState

MsgBox Msg

End Sub


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info