MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Save as message boxes

Posted by Mark on November 23, 2001 1:52 AM

I have a macro that opens several .csv files and saves them as .txt files but on saving the files and closing the worksheet I recieve the message. file_name.txt is not in excel format. do you want to save your changes? How can I avoid this? I do not want to save my changes. Can I also close excel completely on completion of the macro?

Posted by Dank on November 23, 2001 2:08 AM

How about this?

ActiveWorkbook.SaveAs "C:\temp\anyname.txt", xlText
ActiveWorkbook.Close False

The False part of the second line should close the text file without any prompts.


Posted by Mark on November 23, 2001 3:25 AM

1st problem solved. Thanks

Now I just need to know how to close excel on completion. Also being able to overwrite the tesxt files I create would be handy - to avoid the overwrite existing file dialogue box if I haven't moved the files since last time...

Posted by Ian Mac on November 23, 2001 3:47 AM

Application.Quit (NT)

Posted by Dank on November 23, 2001 4:14 AM

Re: 1st problem solved. Thanks

To make the macro overwrite any files without prompting add this line before the line which saves:-