I cannot figure out what is going on here. I can use For Each to iterate through 2 of my classes (Application and Group), but not the other 1 (Section).
Here is the code in my class Application
Here is Section ClassVB Code:
Public Function Sections(Index) As Section Set Sections = mCol.Item(Index) End Function Public Function NewEnum() As IUnknown 'Set procedure Id to -4 Set NewEnum = mCol.[_NewEnum] End Function
Here is Group ClassVB Code:
Public Function Groups(Index) As Groups Set Groups = mCol.Item(Index) End Function Public Function NewEnum() As IUnknown 'Set procedure Id to -4 Set NewEnum = mCol.[_NewEnum] End Function
VB Code:
Public Function Questions(Index) As Questions Set Questions = mCol.Item(Index) End Function Public Function NewEnum() As IUnknown 'Set procedure Id to -4 Set NewEnum = mCol.[_NewEnum] End Function
When I iterate through the Sections in Application and Questions in Group it works fine, but when I iterate through the Groups in Sections, I get the error Object Required
VB Code:
Dim a As New Application Dim s As New Section Dim g As New Group Dim q As New Question a.ID = 1 For Each s In a MsgBox a.Title Next s.ID = 1 For Each g In s MsgBox g.Description Next g.ID = 1 For Each q In g MsgBox q.ControlType Next




I drink to make other people more interesting!
Reply With Quote