Close Workbook from Macro

  • Thread starter Thread starter Lou
  • Start date Start date
L

Lou

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.
 
If you want to save before close
Thisworkbook.Close Tru

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

Regards
(e-mail address removed)
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
 
Lou

Just include this as your last line of code


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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top