ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Close worksheet, dont save (https://www.excelbanter.com/excel-programming/400324-close-worksheet-dont-save.html)

JB2010

Close worksheet, dont save
 
i have a macro in file A that opens file B , copies some data from it, pastes
it to file A, then closes file B.

when it closes file B, i dont want it to save changes.

i can find the command that WILL Save it (ActiveWorkbook.Save), & am
currently using the command to not save it (ActiveWorkbook.Close), however it
always brings up the "Do you want to save changes?" tick box in the middle of
the macro.

how do i get round this? is there a command to say 'close, no changes'?

cheers


jb

OssieMac

Close worksheet, dont save
 
Hi jb,

Application.DisplayAlerts = False
Workbooks("BOOK1.XLS").Close
Application.DisplayAlerts = True

Regards,

OssieMac

"JB2010" wrote:

i have a macro in file A that opens file B , copies some data from it, pastes
it to file A, then closes file B.

when it closes file B, i dont want it to save changes.

i can find the command that WILL Save it (ActiveWorkbook.Save), & am
currently using the command to not save it (ActiveWorkbook.Close), however it
always brings up the "Do you want to save changes?" tick box in the middle of
the macro.

how do i get round this? is there a command to say 'close, no changes'?

cheers


jb


JB2010

Close worksheet, dont save
 
cheers, OssieMac

works a treat!

jb

"OssieMac" wrote:

Hi jb,

Application.DisplayAlerts = False
Workbooks("BOOK1.XLS").Close
Application.DisplayAlerts = True

Regards,

OssieMac

"JB2010" wrote:

i have a macro in file A that opens file B , copies some data from it, pastes
it to file A, then closes file B.

when it closes file B, i dont want it to save changes.

i can find the command that WILL Save it (ActiveWorkbook.Save), & am
currently using the command to not save it (ActiveWorkbook.Close), however it
always brings up the "Do you want to save changes?" tick box in the middle of
the macro.

how do i get round this? is there a command to say 'close, no changes'?

cheers


jb


Dave Peterson

Close worksheet, dont save
 
Another one:

Someworkbook.close savechanges:=false



JB2010 wrote:

i have a macro in file A that opens file B , copies some data from it, pastes
it to file A, then closes file B.

when it closes file B, i dont want it to save changes.

i can find the command that WILL Save it (ActiveWorkbook.Save), & am
currently using the command to not save it (ActiveWorkbook.Close), however it
always brings up the "Do you want to save changes?" tick box in the middle of
the macro.

how do i get round this? is there a command to say 'close, no changes'?

cheers

jb


--

Dave Peterson


All times are GMT +1. The time now is 01:20 PM.

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