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

Is there a way to prevent windows explorer from opening another workbook when
one workbook is already open?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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?

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
prevent workbook opening if already open by someone else KevHardy Excel Discussion (Misc queries) 0 March 4th 10 10:02 AM
Prevent two network users from opening same workbook? Ed Excel Programming 2 May 9th 07 11:46 AM
How can I prevent calculations upon opening workbook? Randy Excel Programming 5 April 2nd 07 04:59 PM
Prevent worksheet from opening in a workbook laurenm Excel Worksheet Functions 5 January 18th 07 05:42 AM
How to prevent any one from opening my workbook MMCM New Users to Excel 5 August 25th 06 07:54 PM


All times are GMT +1. The time now is 02:53 PM.

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

About Us

"It's about Microsoft Excel"