jmckeone
Well-known Member
- Joined
- Jun 3, 2006
- Messages
- 550
This had been working without issue previously but today when I run debug on it there is a choke at the point of the case statement indicating "variable not defined". I believe I'd originally gotten this code here though I could be wrong. Can anyone explain what the issue is on this?
Code:
Private Sub RemoveAllVBA()
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