save without code

  • Thread starter Thread starter Roman Töngi
  • Start date Start date
R

Roman Töngi

Is it possible to save a document without any VBA-code included in that
document?
I should be achieved by VBA-programming.

Regards,
Roman
 
Roman Töngi said:
Is it possible to save a document without any VBA-code included in that
document?
I should be achieved by VBA-programming.

Regards,
Roman

I guess you have to create new document and copy the contens of the doc with
Vba code to that one. I tried to record deleting a macro only to find that
nothing had been recorded. You're better off if you put your VBA code in an
add-in.
/Fredrik
 
Tom Ogilvy said:
Look at Chip Pearson's page on programming with the VBE. I believe he has
sample code for removing. Of course you would want to run this code from a
different workbook than you are stripping the code out of.

http://www.cpearson.com/excel/vbe.htm

How funny. I just found this link when i was researching something else. It
seems as if I was wrong. However, you can't create a self destructing macro.

/Fredrik
 
However, you can't create a self destructing macro.
Yes you can. Try the following:

Sub SelfDestruct()
'
' some code
'
With
ThisWorkbook.VBProject.VBComponents("Module1").CodeModule
.DeleteLines .ProcBodyLine("SelfDestruct",
vbext_pk_Proc), _
.ProcCountLines("SelfDestruct", vbext_pk_Proc)
End With

End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 
To Fredrik:

and of course I said: Of course you would want to run this code from a
different workbook than you are stripping the code out of.
 
Chip Pearson said:
Yes you can. Try the following:

Sub SelfDestruct()
'
' some code
'
With
ThisWorkbook.VBProject.VBComponents("Module1").CodeModule
.DeleteLines .ProcBodyLine("SelfDestruct",
vbext_pk_Proc), _
.ProcCountLines("SelfDestruct", vbext_pk_Proc)
End With

End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com

Cool! I will try this out!
/Fredrik
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top