Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Need a "warning" MsgBox, saying that another Excel file is open and do I wish
to close it before proceeding, and if yes then close without saving. In other words, if ActiveWindow.ActivateNext goes anywhere other than the current file, that warning should pop up. Thanx, - Mike |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Would Workbooks.Count give you what you are looking for? Be careful though,
as it counts the Personal.xls, if it exists, as being open. Perhaps this line will do what you want... WBcount = Workbooks.Count + (Len(Workbooks("Personal.xls").Name) 0) where if WBcount is greater than 1 then another workbook is open in that session of Excel (if you have a second session of Excel open, this code will not see it). Oh, and yes, the + sign in the above code line is correct because the logical expression evaluates to -1 if true. -- Rick (MVP - Excel) "MikeF" wrote in message ... Need a "warning" MsgBox, saying that another Excel file is open and do I wish to close it before proceeding, and if yes then close without saving. In other words, if ActiveWindow.ActivateNext goes anywhere other than the current file, that warning should pop up. Thanx, - Mike |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub mikef()
n = Workbooks.Count If n 1 Then MsgBox ("WARNING!!!" & Chr(10) & "There are " & n & " workbooks open!!") End If End Sub -- Gary''s Student - gsnu200824 "MikeF" wrote: Need a "warning" MsgBox, saying that another Excel file is open and do I wish to close it before proceeding, and if yes then close without saving. In other words, if ActiveWindow.ActivateNext goes anywhere other than the current file, that warning should pop up. Thanx, - Mike |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanx.
"Rick Rothstein" wrote: Would Workbooks.Count give you what you are looking for? Be careful though, as it counts the Personal.xls, if it exists, as being open. Perhaps this line will do what you want... WBcount = Workbooks.Count + (Len(Workbooks("Personal.xls").Name) 0) where if WBcount is greater than 1 then another workbook is open in that session of Excel (if you have a second session of Excel open, this code will not see it). Oh, and yes, the + sign in the above code line is correct because the logical expression evaluates to -1 if true. -- Rick (MVP - Excel) "MikeF" wrote in message ... Need a "warning" MsgBox, saying that another Excel file is open and do I wish to close it before proceeding, and if yes then close without saving. In other words, if ActiveWindow.ActivateNext goes anywhere other than the current file, that warning should pop up. Thanx, - Mike |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Thanx. "MikeF" wrote: Need a "warning" MsgBox, saying that another Excel file is open and do I wish to close it before proceeding, and if yes then close without saving. In other words, if ActiveWindow.ActivateNext goes anywhere other than the current file, that warning should pop up. Thanx, - Mike |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanx.
"Gary''s Student" wrote: Sub mikef() n = Workbooks.Count If n 1 Then MsgBox ("WARNING!!!" & Chr(10) & "There are " & n & " workbooks open!!") End If End Sub -- Gary''s Student - gsnu200824 "MikeF" wrote: Need a "warning" MsgBox, saying that another Excel file is open and do I wish to close it before proceeding, and if yes then close without saving. In other words, if ActiveWindow.ActivateNext goes anywhere other than the current file, that warning should pop up. Thanx, - Mike |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Getting Warning when I try to open ecxel in 2007. | Excel Discussion (Misc queries) | |||
Number add-in warning comes up when opening files | Excel Discussion (Misc queries) | |||
Warning before saving files! | Excel Discussion (Misc queries) | |||
Excel file already open warning | Setting up and Configuration of Excel | |||
Playing .wav files (why do a few cause warning messages?) | Excel Programming |