Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Programatically saving workbook (or worksheet) without the code

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
N10 N10 is offline
external usenet poster
 
Posts: 141
Default Programatically saving workbook (or worksheet) without the code

Hi Hugh

With your SOurce spreadsheet running why dont you use the macro recorder to
create a new workbook then copy the sheet from your Source book to the new
book, then save the new book with any name you choose. That would be a
start and avoids all the form and code issues you describe. You can then
tidy up the code and maybe place in the workbook code as a close event.

Hope this helps

"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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Programatically saving workbook (or worksheet) without the code

Hi Ron,

Thank you very much for your help. As a matter of fact, I
did the same. However, the menue bar group in the
workbook was gone. The group was added onto standard menu
bar. I will also read the website that you provided.

Hugh

-----Original Message-----
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



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Programatically saving workbook (or worksheet) without the code

Hi N10,

Thank you very much for your help. Yes, I did the same as
what you suggested. However, added menu-bar group in
source book was gone after saving. I have no idea how it
happened.

Hugh

-----Original Message-----
Hi Hugh

With your SOurce spreadsheet running why dont you use the

macro recorder to
create a new workbook then copy the sheet from your

Source book to the new
book, then save the new book with any name you choose.

That would be a
start and avoids all the form and code issues you

describe. You can then
tidy up the code and maybe place in the workbook code as

a close event.

Hope this helps

"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



.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Programatically saving XML file as Excel spreadsheet ANN Excel Programming 0 April 22nd 04 09:55 PM
SAVING A COPY OF WORKBOOK W/O THE CODE IN IT gr8guy Excel Programming 2 January 22nd 04 10:18 AM
Saving a Workbook without code KimberlyC Excel Programming 1 August 21st 03 07:07 PM
Excel crashing when (programatically) adding past the 360th worksheet to a workbook Scott Lyon Excel Programming 2 August 14th 03 12:34 PM
Copy Worksheet to another workbook, programatically? plh[_2_] Excel Programming 5 August 13th 03 08:12 PM


All times are GMT +1. The time now is 09:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"