LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Remove VBA code

Hi!
I have removed the VBA code from the workbook "Test.xls", saved and
closed. When I reopened the workbook the message "Workbook countains
macros" popped up.
I saved the workbook and reopened it again and to my surprise no macro
warning occurred. 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
 
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
remove password on VBA code Tom Excel Discussion (Misc queries) 1 February 13th 10 06:36 AM
repeat code remove AMIT BHOPAL Excel Worksheet Functions 3 December 25th 09 10:54 AM
incorporate the remove #DIV/0! code into another formula to get bl Morgan New Users to Excel 5 October 29th 09 04:48 AM
code to remove rows containing a character string kevin Excel Discussion (Misc queries) 4 November 20th 08 03:06 PM
Possible VB code to lookup and remove unwanted data Sarah (OGI) Excel Discussion (Misc queries) 3 December 11th 07 01:18 PM


All times are GMT +1. The time now is 06:17 AM.

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"