![]() |
prevent second workbook opening
Is there a way to prevent windows explorer from opening another workbook when
one workbook is already open? |
prevent second workbook opening
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 -- Regards, Halim "joeeng" wrote: Is there a way to prevent windows explorer from opening another workbook when one workbook is already open? |
prevent second workbook opening
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 "Halim" wrote: 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 -- Regards, Halim "joeeng" wrote: Is there a way to prevent windows explorer from opening another workbook when one workbook is already open? |
All times are GMT +1. The time now is 11:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com