Add All family with the same Standard Organizstion from content center to an listbox in VBA Userform

Add All family with the same Standard Organizstion from content center to an listbox in VBA Userform

Darkforce_the_ilogic_guy
Advisor Advisor
547 Views
1 Reply
Message 1 of 2

Add All family with the same Standard Organizstion from content center to an listbox in VBA Userform

Darkforce_the_ilogic_guy
Advisor
Advisor

I want to userform to Place componemt form Content Center.   but Only all for the Standard Organizstion = "Kalle"

 

for doing this I need to read all the right information into an listbox in VBA.

 

 

I am not sure what to change in the code below

 

Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Fasteners").ChildNodes.Item("Bolts").ChildNodes.Item("Hex Head")

' Find a specific family. In this case it's using the display name, but any family
' characteristic could be searched for.
Dim family As ContentFamily
Dim checkFamily As ContentFamily
For Each checkFamily In hexHeadNode.Families
MsgBox (checkFamily.DisplayName)
If checkFamily.DisplayName = "DIN EN 24016" Then
Set family = checkFamily
Exit For
End If
Next

0 Likes
Accepted solutions (1)
548 Views
1 Reply
Reply (1)
Message 2 of 2

Darkforce_the_ilogic_guy
Advisor
Advisor
Accepted solution

Not that bedst code But it works so far 

 

Private Sub UserForm_Activate()

Dim familyName(24, 1)
Dim number As Integer
number = 0
'Set list = New ArrayList

 Dim hexHeadNode As ContentTreeViewNode
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Angles")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
    Dim family As ContentFamily
    Dim checkFamily As ContentFamily
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    'New profil Type
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Channels")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("I-Beams")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Other")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Round Bars")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Round Tubes")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Square/Rectangular Tubes")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Square/Rectangular/Hex Bars")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
      Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Structural Shapes").ChildNodes.Item("Tees")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
       Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Other Parts")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
        Set hexHeadNode = ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes.Item("Other Parts").ChildNodes.Item("Cable Chains")
    
    ' Find a specific family.  In this case it's using the display name, but any family
    ' characteristic could be searched for.
   
    For Each checkFamily In hexHeadNode.Families
    If checkFamily.StandardOrganization = "Kallesoe" Then
    familyName(number, 0) = checkFamily.DisplayName
    
    number = number + 1
        'If checkFamily.DisplayName = "Threaded Rod" Then
          ' MsgBox (checkFamily.DisplayName)
           ' Exit For
       ' End If
       End If
       
    Next
    
    
    
    UserForm2.ListBox1.List = familyName
End Sub

orm2.ListBox1.List = familyName
End Sub

0 Likes