Results 1 to 26 of 26

Collection inside a class, issues retrieving data

Threaded View

  1. #1
    Registered User
    Join Date
    12-09-2014
    Location
    Norfolk
    MS-Off Ver
    2013
    Posts
    19

    Question Collection inside a class, issues retrieving data

    Hi guy's, im having issues extracting data from a collection inside a class modual. I have put the class into a collection and i can extract information from there, but i wanna know what ive done wrong as i cant get a reference from the class itself.
    I think the issue is coming from this class modual below, when call .item(1) i dont get .sscc, i have over looked something but im not sure what for the life of me



    '''''''''''''' info modual 
    
    
    dim mycls as cls, mycls2 as cls2
    dim rng,rng2 as range
    
    Set mycls = New cls
    Set mycls2 = New cls2
    
    
    Worksheets("dump_data").Activate
    
     Set rng2 = Range("R2", Range("R60000").End(xlUp))
       
    
    With mycls
                             
    For Each c In rng2
    .Add c.Value, .count ''''''''''''''''works added all to collection
    Next
    .item(.count).sscc''''''''''''''''''''' fail.....intelligence doesn't provide .sscc or anything else
    .remove(.count).sscc'''''''''''''''fails aswell in the same way
    end with
    
    mycls2.Add mycls, mycls2.count + 1
    
    mycls2.item(mycls2.count).pSSCC.item(1) ''''''''''works though ???



    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''class modual cls class
    
    Private pId, pname as string
    Public pSSCC As Collection
    ''''''''''''''''''''''''''''''''''''
    'cls class
    ''''''''''''''''''''''''''''''''''''
    
    
    
    
    ''''''''''''''''''''''
    ' Id property
    ''''''''''''''''''''''
    Public Property Get Id() As String
        Id = pId
    End Property
    Public Property Let Id(Value As String)
        pId = Value
    End Property
    
    ''''''''''''''''''''''
    ' name  property
    ''''''''''''''''''''''
    Public Property Get name() As String
        name = pname
    End Property
    Public Property Let name(Value As String)
        pname = Value
    End Property
    
    
    Private Sub Class_Initialize()
    Set pSSCC = New Collection
    
    End Sub
    
    Public Sub Add(item As String, Key As String)
    pSSCC.Add item, Key
    
    End Sub
    
    Public Property Get count() As Long
    count = pSSCC.count
    
    End Property
    
    Public Property Get SSCC() As Collection
        SSCC = pSSCC
    
    End Property
    
    Public Property Let SSCC(Value As Collection)
        pSSCC = Value
    
    End Property
    
    Public Sub remove(indexorname As Variant)
    pSSCC.remove indexorname
    
    End Sub
    
    
    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''bugs out here
    Public Property Get item(indexorname As Variant) As Collection
    Set item = pSSCC(indexorname)
    
    End Property
    
    Public Function NewEnum() As IUnknown
        Set NewEnum = pSSCC.[_NewEnum]
    End Function



    ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''class modual cls2
    
    Private Pcls2As Collection
    
    Private Sub Class_Initialize()
    
    Set Pcls2= New Collection
    
    End Sub
    Public Sub Add(item As cls, Key As String)
    Pcls2.Add item, Key
    
    End Sub
    Public Property Get count() As Long
    count = Pcls2.count
    
    End Property
    Public Sub remove(indexorname As Variant)
    Pcls2.remove indexorname
    
    End Sub
    
    Public Property Get item(indexorname As Variant) As cls
    
    Set item = Pcls2(indexorname)
    
    End Property
    
    Public Function NewEnum() As IUnknown
        Set NewEnum = Pcls2.[_NewEnum]
    End Function

    any ideas???? to point me in the right direction
    Last edited by bennett4455; 07-21-2015 at 05:43 AM. Reason: code tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Class and one property is also a class or collection
    By gosa in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-01-2011, 05:31 PM
  2. Replies: 22
    Last Post: 12-15-2010, 08:49 PM
  3. Collection of Class Modules
    By wildjester in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2009, 09:26 AM
  4. Issues retrieving data from external sources
    By jschell in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-19-2009, 09:09 AM
  5. Class with property as collection of another class
    By MCCCLXXXV in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-26-2008, 04:35 PM
  6. [SOLVED] [SOLVED] RE: Retrieving the Collection of Ranges in a Workbook
    By K Dales in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-19-2005, 06:06 PM
  7. [SOLVED] Retrieving the Collection of Ranges in a Workbook
    By Adam in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-19-2005, 06:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1