I am working on a simple tool that will allow me to parse multiple CSV files and spit them out onto a fresh worksheet "merged" together. Here is my implementation (I've simplified it) and my issue:
Class A
private variables as types
property methods for accessing variables
Class B
private variables as types
property methods for accessing variables
Class C
Private cA as ClassA
Private cB as Collection 'Collection of ClassB
Class D - Part of my problem
Private cC as Collection 'Collection of ClassC
'Other member variables and their property get/lets
Public Sub AddA(A as ClassA)
If cC.Item(A.foo) is Nothing then
dim tempC as ClassC
set tempC = new ClassC
tempC.A = A
End if
End Sub
Main Module - Other half of my problem
Dim cC as New ClassC
'Initialize Class C, this all works fine
Dim tempA as ClassA
Set tempA = new ClassA
'Set tempA properties
cC.AddA tempA 'This is where my error is
I've tried passing it as ByVal and ByRef each gives me different errors ("byref argument type mismatch", "invalid procedure or argument", and "Object doesn't support this property or method"
I have no idea what to try next, I even tried the parenthesis "thing" that supposedly forces the parameter into either ByVal or ByRef, I can't remember, that was yesterday.
Thanks.
AddA, so some code would help. I'd also bet you wantPublic Sub AddA(ByVal A as ClassA).ByVal A as ClassA, I get the "Invalid procedure or argument" error. Please note I added the code for AddA, and realised at the same time I completely left out a class. I've completely updated all the code. Sorry about that.Tools -> Options -> General -> Error Trappingto change where you see the error. In this case you might want "Break in class module."If cC.Item(A.Foo) is Nothing then, according to the docs if the item doesn't exist, it will simply error instead of returning a nothing value. Let me fix this, then we'll see what happens