prevent second workbook opening

G

Guest

Is there a way to prevent windows explorer from opening another workbook when
one workbook is already open?
 
G

Guest

This is work fine for me
NOTE that you open workbook only from same computer:
place this code inside Thisworkbook module:

Dim OpenTimes

Private Sub Workbook_BeforeClose(Cancel As Boolean)
SaveSetting "APPTEST", "SETTING", "OPENTIMES", "0"
End Sub

Private Sub Workbook_Open()
OpenTimes = GetSetting("APPTEST", "SETTING", "OPENTIMES")
If OpenTimes = "1" Then
Me.Close
Else
SaveSetting "APPTEST", "SETTING", "OPENTIMES", "1"
End if
End Sub
 
G

Guest

Thanks for the response Halim. However, that is not quite what I had in
mind. If one workbook is open, I wanted that workbook to prevent any other
workbooks from being opened. Your code would have to be present in every
workbook. I have figured out how to accomplish this by utilizing the
application level events.

joeeng
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top