Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default removed vba code

Hi!
I have a macro that removes the VBA code from the workbook and saves it.
When I reopen the workbook the macro warning popps up. But in the
workbook is no line of code and no module.
Then I simply save the workbook and now I can open it without macro
warning. Can anyone explain that to me?

For vba code deleting I used the macro of www.cpearson.com. See the vba
code below:

Public Sub test()
ThisWorkbook.SaveAs ("Test1")
DeleteAllVBA
ThisWorkbook.Save
End Sub
Sub DeleteAllVBA()

Dim VBComp As VBIDE.VBComponent
Dim VBComps As VBIDE.VBComponents

Set VBComps = ActiveWorkbook.VBProject.VBComponents

For Each VBComp In VBComps
Select Case VBComp.Type
Case vbext_ct_StdModule, vbext_ct_MSForm, _
vbext_ct_ClassModule
VBComps.Remove VBComp
Case Else
With VBComp.CodeModule
..DeleteLines 1, .CountOfLines
End With
End Select
Next VBComp

End Sub

Thanks for your help
Michi






*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
RIBBON TAB NOT BEING REMOVED FARAZ QURESHI Excel Discussion (Misc queries) 5 January 2nd 09 06:15 PM
Why is qw in a cell and cannot be removed? erinping Excel Discussion (Misc queries) 5 August 30th 07 11:56 AM
How to I add Smart Tag that was removed? docexcel Excel Discussion (Misc queries) 2 April 27th 06 11:51 PM
How Is CHOOSESHEET.XLA Removed? kghexce Excel Discussion (Misc queries) 2 January 10th 06 09:46 AM
Password cannot be removed twa14 Excel Discussion (Misc queries) 3 December 14th 04 11:27 AM


All times are GMT +1. The time now is 04:22 PM.

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

About Us

"It's about Microsoft Excel"