Hi all,
I have what is probably a simple question but I can’t figure it out.
I made an Excel based program that uses multiple workbooks with two main workbooks (“Master List” and “Products”) that all the others pull information from.
I run into a problem when a user clicks the close X in the upper right hand corner and the entire application closes.
I found some code that will let me close all the workbooks but one (the code is put in the “Products” workbook in the BeforeClose event).
Code
For Each wb In Workbooks
If Not wb Is ThisWorkbook Then
wb.Close SaveChanges:=True
End If
Next wb
Is there a way to modify the code so it will close all the workbooks but the two main ones if someone clicks the close X button in the upper right hand corner?
Thank you,
Andy