really remova all VBA code from Workbook
Hi!
There is not any module or codes after the deletion of all VBA macros.
Theree are only Excel Objects like "sheet1", ... , "ThisWorkbook"
without any VBA code.
I tried to give manually a dummy code after the deletion and save:
Sub test()
End Sub
I saved this code. I deleted this code manually later and saved the
workbook again. Now if I open the workbook I do not get any message
about macros. It seems me, that I need to do any "refresh" (?) after I
delete all VBA codes????
Charlie
NickHK írta:
Modules and class modules, even without code, will trigger the macro
warning.
So delete them also.
And of course userforms.
NickHK
wrote in message
oups.com...
Hi!
I want to delete all VBA code from the EXCEL Workbook dinamically (so
from VBA program). I use this method:
...
On Error Resume Next
With ActiveWorkbook.VBProject
For x = .VBComponents.Count To 1 Step -1
.VBComponents.Remove .VBComponents(x)
Next x
For x = .VBComponents.Count To 1 Step -1
.VBComponents(x).CodeModule.DeleteLines _
1, .VBComponents(x).CodeModule.CountOfLines
Next x
End With
On Error Goto 0
...
After that I have saved the workbook and I have opened it again, I get
the message box: "this workbook have macros. Would you like to allowe
them? ..." But there is not any more VBA code.
What need I to do, that after the deletion of VBA code, I do not get
this messege at the opening of the workbook again?
Thanks a lot!
Charlie
|