ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Text file closure (https://www.excelbanter.com/excel-programming/287356-text-file-closure.html)

dsan

Text file closure
 
Using VBA I have copied data from a .xls file to a second Excel file
that I have saved as .txt. Having already saved the file is there
anyway that I can suppress the message "Do you wish to save the
changes made to ' .... .txt'?" when I use the command
ActiveWindow.Close to remove the text file from my workspace?

John Tjia

Text file closure
 
Try this:

Activewindow.Close saveChanges:=False



(dsan) wrote in message . com...
Using VBA I have copied data from a .xls file to a second Excel file
that I have saved as .txt. Having already saved the file is there
anyway that I can suppress the message "Do you wish to save the
changes made to ' .... .txt'?" when I use the command
ActiveWindow.Close to remove the text file from my workspace?


John Tjia

Text file closure
 
As a follow up to my first post, that code Activewindow.close
savechanges:=false discards any changes you have made when you close
the file. So you have to make sure that you have saved the file with
any changes that you want to keep!

(dsan) wrote in message . com...
Using VBA I have copied data from a .xls file to a second Excel file
that I have saved as .txt. Having already saved the file is there
anyway that I can suppress the message "Do you wish to save the
changes made to ' .... .txt'?" when I use the command
ActiveWindow.Close to remove the text file from my workspace?


dsan

Text file closure
 
(John Tjia) wrote in message . com...
Try this:

Activewindow.Close saveChanges:=False


Thanks John, this works well and as I said in the original message the
work was already saved so no problems there.


All times are GMT +1. The time now is 03:50 PM.

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