close workbook

  1. C

    VBA to close workbook with different name at the end

    Hi, So closing a specific workbook is simple. Google knows too. But what's the VBA to close a workbook that changes name at the end everyday? Example: Today: A_AgingDetail20220721ghtr Tomorrow: A_AgingDetail20220722erts A. Tomorrow: A_AgingDetail20220723weph So the only...
  2. Martin_H

    Close multiple workbooks

    Hi, would it be possible to simplify this code to fewer lines? The less, the better. Thank you. On Error Resume Next Workbooks("01_jan.xlsm").Close savechanges:=True Workbooks("02_feb.xlsxm").Close savechanges:=True Workbooks("03_mar.xlsm").Close savechanges:=True...
  3. V

    VBA Excel 2007 Security warning when closing workbook with Task Manager

    In Excel 2007 I Create file and macro (vba), I protected workbook using password and to avoid Security warning when closing file through icon red (X) and reopen file and after save my data and indeed, the problem is solved Steps 1- to avoid Security warning (code problem solved is down )2-...
  4. F

    Close a workbook, prompt to save, then save workbook and Excel

    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()...
  5. A

    vba code to close all workbooks except active workbook which has macro

    Hello, Trying to figure out the vba code which can help me to close all opened workbooks except the active one which has macro. Below is my code. But it does not close any workbook. Please help. Thank you in advance. Sub CloseOtherWorkbook() Dim WB As Workbook Windows("Master...
  6. C

    VBA to close workbooks

    Hi there, I have a macro which opens files based on the contents of a cell range. This cell range has the file names and the macro specifies the folder directory. The macro opens whatever cells are selected and then it closes all files. I want it to run as is but with one minor tweak - only to...
  7. A

    Custom Diagloge Before Closing a Workbook *** Help Please ***

    Hi - I am trying to put in a custom dialogue & warning before an user closes the workbook. The code is working fine in all basic / primary requirements with the exception of a small glitch. When user tries to close the workbook, the code will give a warning to the user. If user hits "No" code...
  8. T

    Closing workbook variable

    I have successfully created a macro that opens the latest modified excel file in a folder. However I am unable to close the workbook after I open it. This is what the successful macro looks like: So when workbook opens this is the code that I have used in an attempt to close it This doesn't...
  9. T

    Quit application only if this is the only work book

    I have a workbook called orders.xlsm. it operates entirely from userform so therfore i have the workbook hidden and the user can only see the userform. on the close of the userform the code is as bleow. Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer) If CloseMode =...
  10. H

    VBA close without saving on read only file

    hello people. I am confused. I have written a macro which asks various questions of users in message boxes, then copies the results sheet to a new workbook, which is saved with a new name. So far so good. However, having saved the results, I wish to close the original questionnaire file...
  11. already

    excel crash when using macro to close workbook

    Hi In my last thread I thought that a conflict between macros causes to crash excel (2007) . But this is not true. I have the following strange problem. A simple macro 'ActiveWorkbook.Close' causes excel to crash if I use it with a button on my sheet (a form). When I run the macro via...
  12. B

    VBA Command to close specific workbook?

    Hi all, I've got an excel file which end users open as a template, then once they've put header information in, gets saved as an individual file. After this has occurred, I've got a userform which is called from another workbook (the reason for this being that the form has bitmaps in it, and...
  13. D

    Opening and closing Files within a Macro

    I have a long macro that adds data to four workbooks and saves the data. It then copies and pastes info within the workbook running the macro, prints two forms, gives the workbook a new file name (save as) and closes the workbook. I currently have all the workbooks open on my display. Is...
  14. A

    reference id

    I have a workbook that can be opened by different users at the same time. My goal is to ID each time it is being opened so it can be saved by that ID. What I am thinking is to date, time and user stamp the workbook everytime it is being opened. And because it needs to be unique, a database...

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
Back
Top