I’ve noticed many people trying to find code that on closing a workbook will prompt to save (if changes were made) and then close the workbook and close Excel. The following code should do the trick.
Place this code in a module and link to a command button or shape
Sub CloseWkBk()...
Hi all,
I have some VBA that takes raw output and adds columns to format the final file for upload to another database. At the end the macro shuts down all open instances of Excel. I tried to comment out the last few lines before my error handler (i.e., Application.Quit and...
I have a workbook that, upon opening makes the application invisible and opens it's userform:
Private Sub Workbook_Open()
Parent.Application.Visible = False
UserForm1.Show
End Sub
There is a button on the form to unhide the parent application again, in order for users to modify the sheets...
I am using TaskScheduler to open a spreadsheet to run an Auto_Open subroutine. The Auto_Open subroutine calls various subroutines to pull data from a server, perform calculations, update charts, export pdfs, and send emails. At the end of Auto_Open, a timed popup allows user intervention to stop...
I have an Excel based application which loads an Add-in when the control spreadsheet is opened, and then when the user has completed the task, unloads the Add-in as part of the Workbook_Before Close process. The control spreadsheet is closed by clicking the "X" button on the workbook window...
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.