ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Save Workbook or worksheet (https://www.excelbanter.com/excel-programming/314202-save-workbook-worksheet.html)

Hugh

Save Workbook or worksheet
 
Hi there,

How to save a workbook or worksheet without saving the
code? I want to save a single worksheet on a workbook
with columns of data and a chart. However, a form will
pop up if saved file is open since there are code in
workbook. How do I save worksheet (or workbook)without
saving the code? Thanks in advance.

Hugh

Myrna Larson

Save Workbook or worksheet
 
For a worksheet: Edit menu/Move or Copy Sheet, Copy it to another workbook and
save that.

For a workbook with many sheets, all to be saved, you would have to go to the
VB Editor and remove all standard modules, forms, and classes, manually remove
all code from ThisWorkbook and Sheet modules.

On Wed, 20 Oct 2004 14:34:57 -0700, "Hugh"
wrote:

Hi there,

How to save a workbook or worksheet without saving the
code? I want to save a single worksheet on a workbook
with columns of data and a chart. However, a form will
pop up if saved file is open since there are code in
workbook. How do I save worksheet (or workbook)without
saving the code? Thanks in advance.

Hugh



Hugh

Save Workbook or worksheet
 
Hi Myrna,

Thanks for your reply. Let's say there is only one sheet
and I want to save. I use VBA to programatically save the
worksheet. The question is then how to programatically
remove the code and save. Thanks again.

Hugh

-----Original Message-----
For a worksheet: Edit menu/Move or Copy Sheet, Copy it to

another workbook and
save that.

For a workbook with many sheets, all to be saved, you

would have to go to the
VB Editor and remove all standard modules, forms, and

classes, manually remove
all code from ThisWorkbook and Sheet modules.

On Wed, 20 Oct 2004 14:34:57 -0700, "Hugh"


wrote:

Hi there,

How to save a workbook or worksheet without saving the
code? I want to save a single worksheet on a workbook
with columns of data and a chart. However, a form will
pop up if saved file is open since there are code in
workbook. How do I save worksheet (or workbook)without
saving the code? Thanks in advance.

Hugh


.


Tom Ogilvy

Save Workbook or worksheet
 
Previously posted by Jim Rech:

http://groups.google.com/groups?thre...%40tkmsftngp07


''Needs a reference to the VB Extensibility library set
'Removes from active workbook all:
''Regular modules
''Class modules
''Userforms
''Code in sheet and workbook modules
''Non built-in references
''Excel 4 macro sheets
''Dialog sheets
Sub RemoveAllCode()
Dim VBComp As Object, AllComp As Object, ThisProj As Object
Dim ThisRef As Reference, WS As Worksheet, DLG As DialogSheet
Set ThisProj = ActiveWorkbook.VBProject
Set AllComp = ThisProj.VBComponents
For Each VBComp In AllComp
With VBComp
Select Case .Type
Case vbext_ct_StdModule, vbext_ct_ClassModule, _
vbext_ct_MSForm
AllComp.Remove VBComp
Case vbext_ct_Document
.CodeModule.DeleteLines 1, .CodeModule.CountOfLines
End Select
End With
Next
For Each ThisRef In ThisProj.References
If Not ThisRef.BuiltIn Then ThisProj.References.Remove ThisRef
Next
Application.DisplayAlerts = False
For Each WS In Excel4MacroSheets
WS.Delete
Next
For Each DLG In DialogSheets
DLG.Delete
Next
End Sub


--
Regards,
Tom Ogilvy

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

Thanks for your reply. Let's say there is only one sheet
and I want to save. I use VBA to programatically save the
worksheet. The question is then how to programatically
remove the code and save. Thanks again.

Hugh

-----Original Message-----
For a worksheet: Edit menu/Move or Copy Sheet, Copy it to

another workbook and
save that.

For a workbook with many sheets, all to be saved, you

would have to go to the
VB Editor and remove all standard modules, forms, and

classes, manually remove
all code from ThisWorkbook and Sheet modules.

On Wed, 20 Oct 2004 14:34:57 -0700, "Hugh"


wrote:

Hi there,

How to save a workbook or worksheet without saving the
code? I want to save a single worksheet on a workbook
with columns of data and a chart. However, a form will
pop up if saved file is open since there are code in
workbook. How do I save worksheet (or workbook)without
saving the code? Thanks in advance.

Hugh


.





All times are GMT +1. The time now is 10:43 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com