Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detecting a another workbook has opended
Hi All
In an Excel workbook is there a method to detect that the user has opended or is opening another workbook ? For instance...... A workbook application is open, the user navigates in explorer to another xls file and double clicks it, this opens in the existing instance of xL, is there a way for the already open workbook to detect this new workbook, with the following actions.... 1. Tell the user they must close the current application before loading a new workbook 2. Prevent the new workbook from opening. -- Cheers Nigel |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Detecting a another workbook has opended
In reply to my own request I have come up with the following approach, but
not sure if it is foolproof? Perhaps someone might comment on it? Option Explicit Public wbOpen As Boolean Private Sub Workbook_Deactivate() If Workbooks.Count 1 And wbOpen Then MsgBox "You must close MyApplication before opening another workbook" 'close the rogue book Application.DisplayAlerts = False ActiveWorkbook.Close Application.DisplayAlerts = True End If End Sub Private Sub Workbook_Open() wbOpen = True If Workbooks.Count 1 Then MsgBox "OPEN - You must close the current Excel workooks before opening MyApplication" wbOpen = False Application.DisplayAlerts = False ActiveWorkbook.Close Application.DisplayAlerts = True End If End Sub -- Cheers Nigel "Nigel" wrote in message ... Hi All In an Excel workbook is there a method to detect that the user has opended or is opening another workbook ? For instance...... A workbook application is open, the user navigates in explorer to another xls file and double clicks it, this opens in the existing instance of xL, is there a way for the already open workbook to detect this new workbook, with the following actions.... 1. Tell the user they must close the current application before loading a new workbook 2. Prevent the new workbook from opening. -- Cheers Nigel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Not detecting Open Workbook - Why | Excel Discussion (Misc queries) | |||
Not Detecting Open Workbook Status - Odd?? | Excel Discussion (Misc queries) | |||
Detecting if a Window/Workbook is Open | Excel Discussion (Misc queries) | |||
Detecting Mac Plataform | Excel Programming | |||
Detecting workbook activation | Excel Programming |