ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Close Workbook from Macro (https://www.excelbanter.com/excel-programming/298607-close-workbook-macro.html)

Lou

Close Workbook from Macro
 
I have workbook A.xls in which I run a macro that will
import a text file (B.txt) and save it as B.xls.

Can I incorporate a statement in my macro in A.xls that
will close A.xls at the end?

TIA.



Edwin Tam

Close Workbook from Macro
 
If you want to save before close
Thisworkbook.Close Tru

if you want the workbook close without save
Thisworkbook.Close Fals

Regards

http://www.vonixx.co


----- Lou wrote: ----

I have workbook A.xls in which I run a macro that will
import a text file (B.txt) and save it as B.xls

Can I incorporate a statement in my macro in A.xls that
will close A.xls at the end

TIA




mudraker[_221_]

Close Workbook from Macro
 
Lou

Just include this as your last line of code


Workbooks(ThisWorkbook.Name).Close SaveChanges:=Fals

--
Message posted from http://www.ExcelForum.com



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

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