ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel crashing when trying to close a workbook (https://www.excelbanter.com/excel-programming/433149-excel-crashing-when-trying-close-workbook.html)

George J[_3_]

Excel crashing when trying to close a workbook
 
This may be a long explanation, so my apologies.

I have a HUGE workbook that has 9 userforms and alot of code in it (1MB)
Going through the forms, there is one part that crashes excel.

I enter the area-office into the form which then shows the client combobox.
Select the client and the client workbook is opened in the background - the
address combobox is then shown.
Select the address and textboxes and different details from the client's
property are shown - taking data from the client workbook.

I can cancel the address, which then just shows the client name. Cancel this
and i can select a new client - the client workbook gets closed and this
works fine.
If i try to save - the code will copy the data from the textboxes to the
client workbook and then try to save and close.

The error i get is "The object invoked has disconnected from its clients".

I have tried putting option explicit at the top of every page of code and
referenced everything.

I was using Activeworkbook.close savechanges:=true
Then tried Workbooks(x).close savechanges = true
Tried to save then close seperately, but it crashed on close.
Unloaded the userform and tried to close - still crashed.

I have no idea what could be causing this.

This project is an amalgamation of a few other workbooks that i currently
use, but have been trying to combine into one. I've stepped through the code
and it does what i expect up to this point.

If anyone could offer some advice i would be grateful.



All times are GMT +1. The time now is 11:51 PM.

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