C
Candyman
Is there a difference in code going to Excel 2003?
I have the code to remove a module:
Private Sub RemoveModule(mName As String)
Dim objVBComp As VBComponent
If modExists(mName) = True Then
Set objVBComp = ThisWorkbook.VBProject.VBComponents(mName)
ThisWorkbook.VBProject.VBComponents.Remove objVBComp
End If
End Sub
'Before using these procedures, you'll need to set a reference in VBA to the
'VBA Extensibility library. In the VBA editor, go to the Tools menu, choose
'the References item, and put a check next to "Microsoft Visual Basic For
'Applications Extensibility" library.
Function modExists(modName As String) As Boolean
On Error Resume Next
modExists = Len(ThisWorkbook.VBProject.VBComponents(modName).Name) <> 0
End Function
The code does not remove it and has a cannot recognize vbProject in workbook
error. What is wrong?
Thanks
I have the code to remove a module:
Private Sub RemoveModule(mName As String)
Dim objVBComp As VBComponent
If modExists(mName) = True Then
Set objVBComp = ThisWorkbook.VBProject.VBComponents(mName)
ThisWorkbook.VBProject.VBComponents.Remove objVBComp
End If
End Sub
'Before using these procedures, you'll need to set a reference in VBA to the
'VBA Extensibility library. In the VBA editor, go to the Tools menu, choose
'the References item, and put a check next to "Microsoft Visual Basic For
'Applications Extensibility" library.
Function modExists(modName As String) As Boolean
On Error Resume Next
modExists = Len(ThisWorkbook.VBProject.VBComponents(modName).Name) <> 0
End Function
The code does not remove it and has a cannot recognize vbProject in workbook
error. What is wrong?
Thanks