Would someone take a minute and compile this simple VBE code and tell me what you get. I get type mismatch error (Word 97) unless I declare vbComp as Object. You’ll need a reference to VBA extensions.
Dim vbComp As VBIDE.VBComponent
Dim vbComps As VBIDE.VBComponents
‘Either of these lines cause the error
Set vbComps = ThisDocument.VBProject.VBComponents
or
Set vbComps = Application.VBE.ActiveVBProject.VBComponents
I’m trying to loop thru all the components in a project like this:
for each vbComp in vbComps
debug.print vbComp.Name
‘bla bla bla
next
Yes, I can do it with Object declarations, but I really want to know why I get the error.