I'm writing an Excel macro in VBA to send emails to library patrons alerting them of overdue materials. The data comes from a spreadsheet with data like
UserID Name Email Title Author Barcode Call Number Borrowed Date Due Date
user2 Jones, Bob bob@jones Title1 A. Baker a0001 H00027C 11/23/2014 1/1/2015
user2 Jones, Bob bob@jones Title2 C. Dalton b0002 S00406R 11/23/2014 1/1/2015
user3 Smith, Mary bob@jones Title3 E. Franklin c0003 M00174R 11/23/2014 1/1/2015
user3 Smith, Mary mary@smith Title4 F. Gelt d0004 M00157G 11/23/2014 1/1/2015
user3 Smith, Mary mary@smith Title5 H. Ivers e0005 M00081G 11/23/2014 1/1/2015
I started out with a user defined type for book and patron, and gave each patron an array of books. I tried passing the patron to a function to generate the email text, but apparently I can't pass a user defined type as a parameter. So, now I'm trying classes.
I want to have a Book class with members
Public book_title As String
Public date_borrowed As Date
Public date_due As Date
Public barcode As String
Public call_number As String
and a EmailData class with members
Public email_text As String
Public patron_name As String
Public patron_email As String
Public sender_email As String
Public book_list() As Book
where book_list is an array of Book objects, and a method sendEmail().
But, this isn't working because apparently I can't define an array of Book objects as a member of the an EmailData object.
So, what is my approach here? I've heard of collections. Would that be a solution?