ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Cannot suppress an ErrorMessage (https://www.excelbanter.com/excel-programming/307172-cannot-suppress-errormessage.html)

don bowyer

Cannot suppress an ErrorMessage
 
I have 2 separate applications, open at the same time.
When I select any one from "Window" in the Menu Bar I use
Private Sub Workbook_WindowActivate(ByVal Wn As Window)and
Private Sub Workbook_WindowDeactivate(ByVal Wn As
Window),located in "ThisWorkbook" , to set different
Custom ToolBars for each application.
That's OK. However when I close one of the applications
using Workbooks("XXXXXX.xls").Close in a separate module,
all is OK except for an Error Message "Application-defined
or Object defined Error" The "culprit" seems to be use of
the above Activate/DeActivate methods.
I have tried to suppress this message using OnError but
failed.
Any suggestions would be welcome.
Don

Tom Ogilvy

Cannot suppress an ErrorMessage
 
I think you have to look at your code and see if you try to do something to
a commandbar or something that has already been deleted.

--
Regards,
Tom Ogilvy

"don bowyer" wrote in message
...
I have 2 separate applications, open at the same time.
When I select any one from "Window" in the Menu Bar I use
Private Sub Workbook_WindowActivate(ByVal Wn As Window)and
Private Sub Workbook_WindowDeactivate(ByVal Wn As
Window),located in "ThisWorkbook" , to set different
Custom ToolBars for each application.
That's OK. However when I close one of the applications
using Workbooks("XXXXXX.xls").Close in a separate module,
all is OK except for an Error Message "Application-defined
or Object defined Error" The "culprit" seems to be use of
the above Activate/DeActivate methods.
I have tried to suppress this message using OnError but
failed.
Any suggestions would be welcome.
Don




Bob Flanagan

Cannot suppress an ErrorMessage
 
Don, the error message means that you are referring to an object that does
not exist. For example, tying to to close a workbook that is already
closed, or getting a value from a sheet that has been deleted.

Robert Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel

"don bowyer" wrote in message
...
I have 2 separate applications, open at the same time.
When I select any one from "Window" in the Menu Bar I use
Private Sub Workbook_WindowActivate(ByVal Wn As Window)and
Private Sub Workbook_WindowDeactivate(ByVal Wn As
Window),located in "ThisWorkbook" , to set different
Custom ToolBars for each application.
That's OK. However when I close one of the applications
using Workbooks("XXXXXX.xls").Close in a separate module,
all is OK except for an Error Message "Application-defined
or Object defined Error" The "culprit" seems to be use of
the above Activate/DeActivate methods.
I have tried to suppress this message using OnError but
failed.
Any suggestions would be welcome.
Don





All times are GMT +1. The time now is 11:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com