![]() |
Closing file with macro
I would like to automatically close a file without saving using a macro. Any
suggestions? |
Closing file with macro
Dim wkbk as workbook
Set wkbk = workbooks("someworkbooknameherethat'salreadyopen.x ls") wkbk.close savechanges:=false dwake wrote: I would like to automatically close a file without saving using a macro. Any suggestions? -- Dave Peterson |
Closing file with macro
You can record a macro that will copy all of the movements. To record the
macro, go to Tools == Macro == Record Macro. That will pull up the Record Macro window, name your macro, and give it a shortcut key if you want. Once you hit ok, all of your movements will be recorded until you hit the stop macro button. All you need to do is close the file without saving and stop the macro. "dwake" wrote: I would like to automatically close a file without saving using a macro. Any suggestions? |
Closing file with macro
Might be a good idea to record the macro in some other workbook than the one
you're closing without saving<g When you record to new workbook all you get from the recorder is Sub Macro3() ActiveWorkbook.Close End Sub Which closes the original workbook with a "do you want to save" message. So you would have to add the bits that Dave posted. Gord Dibben MS Excel MVP On Tue, 1 Dec 2009 16:10:01 -0800, Bryan wrote: You can record a macro that will copy all of the movements. To record the macro, go to Tools == Macro == Record Macro. That will pull up the Record Macro window, name your macro, and give it a shortcut key if you want. Once you hit ok, all of your movements will be recorded until you hit the stop macro button. All you need to do is close the file without saving and stop the macro. "dwake" wrote: I would like to automatically close a file without saving using a macro. Any suggestions? |
All times are GMT +1. The time now is 07:48 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com