beforeclose event

  1. J

    Code in BeforeClose is executing but having no effect

    I have the following code in an Excel 2010 workbook: Private Sub Workbook_BeforeClose(Cancel As Boolean) Application.EnableEvents = True Dim FileName As String FileName = ActiveWorkbook.Name If FileName = "False" Then Exit Sub If FileName <> "Shipping Manifest...
  2. L

    Check whether the current user has been removed (kicked) from the shared workbook?

    I have a shared document which runs various commands upon close. This includes saving normally (if document is still shared) and saving as shared (if document was unshared). The problem arises when a person left the document open for a while then close it. The document automatically overrides...
  3. A

    Closing secondary files

    I am looking for a line of VBA code to use after I execute code to go into a secondary file to make an update and then “save (as new file) and close” the secondary file without having to get the exit message that asks me if I want to save the file. I am currently using the following lines in a...
  4. R

    Workbook_BeforeClose (Cancel As Boolean)

    Hi, I have read all there is in here on the Workbook_BeforeClose and I cant get it to work. The jist is to protect all sheets and the workbook whenever a user closes the workbook. Current code is (which is under ThisWorkbook). Any help would be excellent and thanks in advance. Private Sub...
  5. rudfaden

    SaveCopyAs runtime error

    When i use the following code in Excel 2011 for Mac i get runtime Error 1004. Does anyone have an idea to fix it? Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim Msg As String Dim Ans As Integer Dim FName As String Msg = “Would you like to make a backup of this file?” Ans =...
  6. ClimoC

    BeforeClose problem - Cancel close

    I'm not even entirely sure my code will work, but right now I'm getting stuck on something else "Compile Error: Procedure declaration does not match descfription of event or procedure having the same name" Is the error I get when this fires: Private Sub Project_BeforeClose(Cancel As...
  7. C

    Workbook_BeforeClose event

    When I open an excel file the workbook open event runs code to disable cut, copy and paste and hides the formula bar. When the file is closed I wish to enable cut, copy and paste and show the formula bar. I have tried the following code but it doesn't work. Does anyone know how to write code...

Watch MrExcel Video

This Week's Hot Topics

We've detected that you are using an adblocker.

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.
Go back
Top