ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Closing a file with macros (https://www.excelbanter.com/excel-programming/433673-closing-file-macros.html)

Alberto Ast[_2_]

Closing a file with macros
 
I want to close an excel file that has been modified but I do not want to be
ask if i want to save changes.. if I do as follows

Windows("Excel file name.xls").Activate
ActiveWorkbook.Close

Excel will ask me if I want to save changes... I do not want this... just
close it.


FSt1

Closing a file with macros
 
hi
try this.........
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True

regards
FSt1

"Alberto Ast" wrote:

I want to close an excel file that has been modified but I do not want to be
ask if i want to save changes.. if I do as follows

Windows("Excel file name.xls").Activate
ActiveWorkbook.Close

Excel will ask me if I want to save changes... I do not want this... just
close it.


Alberto Ast[_2_]

Closing a file with macros
 
Worked great thanks.

"FSt1" wrote:

hi
try this.........
Application.DisplayAlerts = False
ActiveWorkbook.Close
Application.DisplayAlerts = True

regards
FSt1

"Alberto Ast" wrote:

I want to close an excel file that has been modified but I do not want to be
ask if i want to save changes.. if I do as follows

Windows("Excel file name.xls").Activate
ActiveWorkbook.Close

Excel will ask me if I want to save changes... I do not want this... just
close it.


Dave Peterson

Closing a file with macros
 
Or

workbooks("Excel file name.xls").close savechanges:=false

No need to activate it first.

Alberto Ast wrote:

I want to close an excel file that has been modified but I do not want to be
ask if i want to save changes.. if I do as follows

Windows("Excel file name.xls").Activate
ActiveWorkbook.Close

Excel will ask me if I want to save changes... I do not want this... just
close it.


--

Dave Peterson

Alberto Ast[_2_]

Closing a file with macros
 
It is a very good option and will allow me to do even more.

Thanks

"Dave Peterson" wrote:

Or

workbooks("Excel file name.xls").close savechanges:=false

No need to activate it first.

Alberto Ast wrote:

I want to close an excel file that has been modified but I do not want to be
ask if i want to save changes.. if I do as follows

Windows("Excel file name.xls").Activate
ActiveWorkbook.Close

Excel will ask me if I want to save changes... I do not want this... just
close it.


--

Dave Peterson



All times are GMT +1. The time now is 11:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com