Hi good people!,
I have posted yesterday on Mrexcel, but to date no replies. The link is: http://www.mrexcel.com/forum/excel-q...se-button.html
There are literally hundreds of threads on this topic, BUT..(Always a "BUT"), the circumstances surrounding them are all different to mine, some of them give replies, but for some reason do not work when I implement them..therefore the thread.
I have two codes: one in the "This workbook":and a userform with this code:Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.Visible = True If CloseMode = 0 Then Cancel = True End SubThe userform DID work, until I disabled the workbook close button. How can I amend the code in the userform to close the workbook?. I have tried:ActiveWorkbook.Close SaveChanges:=True
but get an error "variable not defined"...please help...thank you all very kindly..If CloseMode = 1 Then Cancel = False ActiveWorkbook.Close SaveChanges:=True