Hi,
I have the following data that I put in an array.
To put it in an array I used this.ID---------Name-----Type---------NR--------De---------Cr
A001----Chris-------F66----------1111-----------------10
A001 ----Chris-------FACT-------1234------10
A001 ----Chris-------F66----------5678-----15
B002 ----Sarah------F58----------2222-------7
C003 ----Bill----------FACT--------3333-------5
Now I'm trying to put everyting in classes.ClientArray = ActiveSheet.UsedRange
The Class is called clsClient
And has the following properties:
Public ClientID As String Public ClientName As String (a property to hold several invoices)
But I'm stuck with the invoice properties cause I should use a different class.
For example clsInvoice with the following properties:
Public InvCode As String Public InvNr As String Public InvDebit As Double Public InvCredit As Double
1) How can I add the clsInvoice as a property to clsClient cause it's not one invoice per client but there can be several invoices.
Do I need to create another class to hold all the invoices? Like a collection class?
(I have no experience with collection classes)
2) How can I loop through the array and fill the class correctly.
This code is not finished and definitely wrong :-/
Thanks in advance!
Greets
Last edited by gosa; 12-01-2011 at 04:32 PM.
The simplest way would be to add a Collection object to the first class and then add the invoices to that.
I would also recommend reading through Patrick's article here.
Last edited by romperstomper; 12-01-2011 at 05:15 AM.
Hi thanks for the link.
After reading the other links in the article and experimenting I was able to solve it.
I did it manually though without the add-in because for some very strange reason I was only able to use the add-in once. After I filled the form in and closed Excel and went back in to try the add-in again. I always got a error 94, something about 'Invalid use of Null'.
Anyway it worked so I'm glad.
As for my project I ended up with 4 classes.
2 basic classes and 2 collection classes.
Thanks again for getting me on the right track.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks