mattdrinks
Technical User
Hi All,
I have a Class module in Excel:
(Short Version)
I can not seem to find a way to loop through all the properties of the class, I have tried:
Error: Object does not support this property or method.
and
Error: Method or data member not found
Does anyone know if there is a way I can loop through all the properties of a class, or another way I can achieve the same thing?
Thanks,
Matt
I have a Class module in Excel:
(Short Version)
Code:
Dim strPartNumber As String
Dim strSupplierCode As String
Dim dblNPP As Double
'***PART NUMBER***
Property Get PartNumber() As String
PartNumber = strPartNumber
End Property
Property Let PartNumber(Part As String)
strPartNumber = Part
End Property
'***SUPPLIER CODE***
Property Get SupplierCode() As String
SupplierCode = strSupplierCode
End Property
Property Let SupplierCode(Supplier As String)
strSupplierCode = Supplier
End Property
'***NPP***
Property Get NPP() As Double
NPP = dblNPP
End Property
Property Let NPP(Price As Double)
dblNPP = Price
End Property
I can not seem to find a way to loop through all the properties of the class, I have tried:
Code:
Dim proItem As Property
Dim STDTemp As STDProduct 'My Class
Set STDTemp = New STDProduct
For Each proItem In STDTemp 'Error here
MsgBox proItem.Name
Next
and
Code:
Dim proItem As Property
Dim STDTemp As STDProduct 'My Class
Set STDTemp = New STDProduct
For Each proItem In STDTemp.Properties 'Error here
MsgBox proItem.Name
Next
Does anyone know if there is a way I can loop through all the properties of a class, or another way I can achieve the same thing?
Thanks,
Matt