Save As without VBA project

  • Thread starter Thread starter Gordon Rainsford
  • Start date Start date
G

Gordon Rainsford

After running some VBA code on an Excel file, I'd like to save the
file under a different name, but without saving the code. Is this
possible?

Alternatively I could copy the worksheet into a new file, but I need
to keep all the formatting including column widths & row heights.

Thanks,

Gordon Rainsford
 
If you save the file as an .xlsX file the code is removed. If desired then
save as .xls
 
It works great, Steve. Many thanks. But I'm puzzled as to why there's
no need to specify "Paste" or "Destination"?

Gordon
 
If you are using xl2003 or earlier, then it is just as easy to do a save as
and delete the code from the new workbook manually. If you are using xl2007
or later you can just save as .xlxs and it automatically omits the code.
 
When you just copy a sheet it goes to a new wb. Could even be simpler.

Sub savenomacro()
Worksheets(Array("Sheet1", "Sheet2", "Sheet3")).Copy
ActiveWorkbook.SaveAs Filename:="MyNewBook" 'default ext
ActiveWorkbook.Close ' closes new book if desired
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
It works great, Steve. Many thanks. But I'm puzzled as to why there's
no need to specify "Paste" or "Destination"?

Gordon
 
If you are using xl2003 or earlier, then it is just as easy to do a save as
and delete the code from the new workbook manually.  

Not really. The idea is for it to be used by people who don't
understand VBA, and to produce output that isn't going to trigger
warning messages when emailed or downloaded.


Gordon Rainsford
 
Oh, I didn't see that stipulation in the original post. Sorry.


If you are using xl2003 or earlier, then it is just as easy to do a save
as
and delete the code from the new workbook manually.

Not really. The idea is for it to be used by people who don't
understand VBA, and to produce output that isn't going to trigger
warning messages when emailed or downloaded.


Gordon Rainsford
 
Back
Top