View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Michel Pierron Michel Pierron is offline
external usenet poster
 
Posts: 214
Default Disable the opening of another workbook

Hi DDLY;

Private Sub Workbook_BeforeClose(Cancel As Boolean)
Application.OnWindow = ""
End Sub

Private Sub Workbook_Open()
Application.OnWindow = ThisWorkbook.Name & "!ThisWbkOnly"
End Sub

In a standard module:
Sub ThisWbkOnly()
If Not ActiveWorkbook.Name = ThisWorkbook.Name Then
ActiveWorkbook.Close False
MsgBox "This session of Excel is reserved for the " & ThisWorkbook.Name
& " !"
End If
End Sub

MP

"DDLY" a écrit dans le message de
...
Dear all, I just would like to know how could I prevent the opening of
second workbook while the first workbook is opened or in using. Great
thanks!