View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Programatically saving workbook (or worksheet) without the code

Hi Hugh

If there is no event code in the sheet module you can create a new workbook with the sheet like this

Sub test()
ActiveSheet.Copy
With ActiveWorkbook
.SaveAs "C:\ron.xls"
.Close False
End With
End Sub

See also Chip pearson's site
http://www.cpearson.com/excel/vbe.htm

If you want it easy then you can use my SendMail addin and send a copy to yourself
The Add-in have a option to delete the code
http://www.rondebruin.nl/mail/add-in.htm


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Hugh" wrote in message ...
Hi there,

I have a excel workbook with single sheet and want to
save. The problem is that there are a couple of forms in
workbook_open event. If I use workbook.Saveas method to
save the book, those forms will pop up when I open saved
files. What is the best way to save workbook without
saving the code? Or what is the best way to
programatically delete the code and save? I copied the
book to a new book and save the new book by using
Workbook.SaveAs FileName:= "Name", FileFormat:=
xlExcel4, "", "", "", I also able to save the book without
the code. But the problem is that those forms poped up
twice during copy book and reactive original book since I
need to bring original book back for upcoming process.
Thank you very much in advance for help.

Hugh