AddMethod



Public Sub Add(obj As MyClass, Optional Key As String, _
Optional Before As Variant, Optional After As Variant)
Dim blnKey As Boolean
Dim blnBefore As Boolean
Dim blnAfter As Boolean
blnKey = Len(Trim(Key)) <> 0
blnBefore = Not IsMissing(Before)
blnAfter = Not IsMissing(After)
If blnBefore And blnAfter Then
Err.Raise 5
ElseIf blnKey And blnBefore Then
m_col.Add obj, Key, Before
ElseIf blnKey And blnAfter Then
m_col.Add obj, Key, , After
ElseIf blnKey Then
m_col.Add obj, Key
ElseIf blnBefore Then
m_col.Add obj, , Before
ElseIf blnAfter Then
m_col.Add obj, , , After
Else
m_col.Add obj
End If
End Sub


(addmethod.html)- by Paolo Puglisi - Modifica del 25/3/2019