![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Guest
Posts: n/a
|
Thought I would try to learn to create/use macros - don't know what I did but apparantly I created something... went to delete it (toolsmacrosselected 'this workbook' and deleted) - but the beast still lives on - when opening workbook I get warning msg. about file contains macros ( disable/enable?)- but when I go to toolsmacrosetc. - no macros are displayed - how do I get rid of this? Thanking in advance - the users of the workbook freak when they see the warning message containg both the 'macro' and 'virus' words...
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Sydney, Australia
Posts: 2,908
|
Put this code in another workbook, then select the workbook containing 'ghost' macros and run the macro DeleteAllVBA. This code is from Chip Pearson's website. YOU MUST set a reference to the Microsoft Visual Basic for Applications Extensibility library before running (Tools, References and then check that library) otherwise you'll get an error.
http://www.cpearson.com/excel/vbe.htm HTH, D Code:
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
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|