I have an Excel workbook that we use as a form. I have added a button that when clicked if this is the only form open Excel closed completely, but if Excel has another workbook opened it will only close the form.
ActiveWorkbook.Saved = True
If Workbooks.Count >= 2 Then Application.Quit '2 needed to include personal.wkb
This works but only if the user opens another Excel file from the menu bar (OPEN FILE) within the form. If Excel or another Excel file is opened by a shortcut, or other means, the code doesn't see it and cause the application to quit.
Is this possible?