MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Quick Question: How to close a file in VBA...

Posted by Chris Rock on November 19, 2001 7:38 PM

I have a macro that copies sheets to a new workbook, saves them with a filename, and repeats until it has copied all the sheets in the workbook.

THe problem is, the files are staying open after being created.

What's the best (easiest) way to quickly save and close them using VBA?

Posted by NiuB on November 19, 2001 8:07 PM

Try this..

after your code..before the "end sub" line add this
line..and i bet you would like to save the change
for your file...right..