beforeclose

  1. E

    How to use personal macros that will work each time any excel file closes

    I've writtenamacro in my whose purpose is to ask me, when I try to close thefile, whetheror not all tasks have been completed within that specificfile. Rather than addthis to the numerous excel files I get into each day, I'dlike to add it to mypersonal workbook. The problem I’m having is that...
  2. J

    Beforeclose does not work

    Hello all, I have the following code in a module and it does not display the message or save the workbook before closing it.What i am doing wrong?! Thank you in advance. Public Sub Workbook_BeforeClose() MsgBox "Save" ThisWorkbook.Save End Sub
  3. A

    Excel 2013 vba

    Hiya, So im pretty new too excel and im trying to create a document that if mandatory fields are not filled out then you cannot close the document and a POP UP will appear saying *Please fill out this mandatory field* . However I want it for a range off cell but not necessary in the same...
  4. L

    enable cutcopy

    Hi good people!, my friend's pc just suddenly gave a problem. He was opening files and everything worked, until he opened another. Cut, Copy, Paste, Delete, "drag and drop", everything is greyed out. I wrote the "application cutcopymode=true" in the workbook beforeclose event, but even with...
  5. C

    BeforeClose optional message box

    I have a workbook setup to not close if certain cell(s) are not filled out to prevent error (code below). However, it has become rather annoying if we need to open a sheet just for reference as we have to fill in all of the cells to before excel will close. Instead of preventing the worksheet to...
  6. S

    BeforeClose event fires and runs code but does not cleanup

    When the user opens my application, some tidying up is done: Private Sub Workbook_Open() shtMain.Activate ExcelLockDown End Sub Sub ExcelLockDown() With Application .CellDragAndDrop = False .CutCopyMode = False .OnKey "^c", "" .OnKey "^v", ""...
  7. T

    BeforeClose not running

    Good afternoon All, My first post to MrExcel B) I want a macro that password protects all sheets in the workbook called 'Potato' when the workbook is closed. For some reason it doesn't work and I can't figure our why :s Can anyone help me? This is what I've written: Option Explicit Sub...
  8. Mississippi Girl

    Backup works for some users, not for others...

    We have a workbook that is shared by a lot of people. It's saved on a network drive and users of the workbook go in and make updates as needed. We've been having problems with folks forgetting to save their work, so I included this bit of code to save a "back up" before the file is closed...
  9. 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...
  10. Maximus Tatius

    Adding a BeforeClose event to a Workbook created using Workbooks.Add

    I have a fairly complex workbook which contains a worksheet I use as a template for a new workbook - I populate this as part of a long script which fires when I click a command button on a form, then copy this sheet to a new workbook which I create and save in the same script. This works fine...
  11. K

    Saved = True not working in BeforeClose due to charts updating

    Hi. I have a seemingly strange problem with a macro enabled workbook. In the BeforeClose sub i force the workbook to save with Me.Save However, when I try to close the workbook Excel always shows the standard Save dialogue. I've doubled checked that Me.Saved = True when running BeforeClose...
  12. D

    VBA Excel Crashes when .saveas called inside beforeClose on Mac

    Hey folks, interesting problem here. I have an order form that users fill out and send in using VBA. I must avoid the original file being saved over and prompt the user to saveas if they haven't saved a copy of the workbook since they opened it. I want to be able to give the user the option...
  13. T

    BeforeClose/ BeforeSave - required fields

    Hi all! I would like to add a script that forces the user to edit certain fields upon saving/closing the workbook. In the "Revision history" sheet, I've added a script that populates the date and author columns automatically, when Description and revision fields are edited. Se code below...
  14. M

    BeforeClose event

    Hi, Does anyone know if there's a BeforeClose Application event, rather than a BeforeClose Workbook event? Or some way to disable the main Application Close button when more than one workbook is open? I'm having a problem with some workbooks that rely heavily on event macros. The workbooks...
  15. J

    Minor issue with BeforeClose functionality

    First of all, I apologise for the lack of, or incorrect, terminology for this query. Is there any way to bypass code that exists under Workbook 'BeforeClose' event, when required? Here's what's happening... I have an "On Error Goto GenErr" in various locations in the project incase there is a...
  16. P

    Stop Msg Box if process completed

    I have a Workbook with links to a second Workbook - at the end of each week the user needs to run a Macro to break the links (I have this one) As a reminder I'm currently showing a Msg Box anytime the file is closed reminding them to run the Macro if they have completed processing for the week...
  17. S

    How Do I Designate a Column in My Macro

    I am using the following 2 macros to change the font color from Black to White before printing and then back again once I save the file. I never could get Lenze's solution from Feb 2002 to work. Just for the record, Lenze has helped me plenty (directly and indirectly), so I'm not hating...
  18. B

    Before Close Multiple Inactive Workbook Close

    Hi I wrote a simple function to open 3 workbooks upon opening a workbook, Then i wrote a simple one to close the 3 workbooks, this works fine as a sub, However when placed as a Private Sub in the BeforeClose section it doesn't work and tells me subscript is out of range any ideas? Private...
  19. T

    Use workbook_beforeclose without loosing the question "do you want to save your changes"

    All, <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p> <o:p></o:p> I wish to update the workbook each time it's being closed, and I do it by using workbook_beforeclose, and then ThisWorkbook.Save<o:p></o:p> <o:p></o:p> When working like that, I'm losing...

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