D
Daniel Bonallack
Having difficulties posting - I fear I'm going to log on and see my question
8 times (please forgive me!).
Anyway, I want to delete all modules (about 20) and all forms (about 10) in
my workbook, and I am having great difficulty applying Chip Pearson's code.
I'm wondering if I don't have a necessary reference added - I continue to get
error messages.
Trying this line from Chip:
ThisWorkbook.VBProject.VBComponents("Module1").Name = "Module2"
returns this error:
"Programmatic access to Visual Basic Project is not trusted"
And this procedure:
Sub DeleteModule()
Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("NewModule")
ThisWorkbook.VBProject.VBComponents.Remove VBComp
End Sub
returns this error:
"User-defined type not defined"
All my code is under the "Forms" folder and "Modules" folder, not under
sheets or "ThisWorkbook"
Can anyone see where I'm going wrong?
Thanks in advance
Daniel
8 times (please forgive me!).
Anyway, I want to delete all modules (about 20) and all forms (about 10) in
my workbook, and I am having great difficulty applying Chip Pearson's code.
I'm wondering if I don't have a necessary reference added - I continue to get
error messages.
Trying this line from Chip:
ThisWorkbook.VBProject.VBComponents("Module1").Name = "Module2"
returns this error:
"Programmatic access to Visual Basic Project is not trusted"
And this procedure:
Sub DeleteModule()
Dim VBComp As VBComponent
Set VBComp = ThisWorkbook.VBProject.VBComponents("NewModule")
ThisWorkbook.VBProject.VBComponents.Remove VBComp
End Sub
returns this error:
"User-defined type not defined"
All my code is under the "Forms" folder and "Modules" folder, not under
sheets or "ThisWorkbook"
Can anyone see where I'm going wrong?
Thanks in advance
Daniel