ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Best tutorial for building base/collection classes? (https://www.excelbanter.com/excel-programming/363168-best-tutorial-building-base-collection-classes.html)

Brian J. Matuschak

Best tutorial for building base/collection classes?
 
Greetings:

I have an Excel 2003 workbook with a sheet that was intended to schedule
someone on the sheet (marked with green cells) through automation to Outlook
2003. Now I find that I have to expand this to batch scheduling, and it
would seem that I'd have to use a Collection object as it gathers from the
sheet the event name, the employee name, start date, and end date, and that
the reference would have to be called from this snippet in my code:
' Stuff up here works
Next intColCounter
' Add a scheduled employee to the collection with event name, employee name,
start date, and end date that are stored in variables created above
Next intRowCounter
' Iterate through the collection and send Outlook appointments to shared
calendars (I know how to do this).

So, I've done a lot of searching through books and the Web, but nothing
seems to stick. Does anyone out there know of a basic primer or tutorial out
there that doesn't refer to VB 6 forms or is written in a continuous manner?
The "Microsoft Visual Basic 6.0 Programmer's Guide" is a bit disjointed.

Your help is most appreciated,
--
Brian J. Matuschak


tony h[_128_]

Best tutorial for building base/collection classes?
 

Te way you describe what you are trying to do leaves me a little
confused. In this circumstance I would normally do the following.

1. Create a class object to store the data about one person. Use Insert
ClassModule and name it eg clsMyPerson .
In the class module you need to create properties for each piece of
data (name, start date, etc) Use Insert ... Procedure ... Property

and variables in the Class Module to store the data

eg code in class module

Option Explicit

Dim sName As String

Public Property Get Name() As String
Name = sName
End Property

Public Property Let Name(ByVal sNewName As String)
sName = sNewName
End Property


Then in your loop (having declared a Dim ClsPerson as clsMyPerson)

set clsperson = new clsmyperson

populate the values

clsperson.name= namestringvalue

Then once populated just add it to a collection object. Although I
would normally keep the collection object in a class object of it's
own. As it makes it more manageable.

regards


--
tony h
------------------------------------------------------------------------
tony h's Profile: http://www.excelforum.com/member.php...o&userid=21074
View this thread: http://www.excelforum.com/showthread...hreadid=548017



All times are GMT +1. The time now is 09:26 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com