My latest Atempts:
http://www.box.net/public/32fnibnthk
Hi Tom,
I've been spending a lot of time going over your code, and reading through a Visual Basic Objects book. Each time I come back I find that I am understanding more. I am thoroughly enjoying this process, even if I a little slow.
The modification's I've made are mostly restricted to the 'piece' and 'use' classes. I've managed to make some properties implicitly/passively/privately? not sure the terminology. I've tried doing this with the ID property for the 'Piece' and 'Use' objects. (I'm pretty sure 'Use' will be the lowest object.) I concatenated the Piece.Section property (Not to be confused with the 'Section' object) with the Piece.Day property to form a unique Piece.ID.
I seem to be able to Add use object this way, but I have not had luck getting information back out of the use object. Perhaps you could take a look at my modification. I am receiving an error at the last line of Example1(). Thank you for sticking with this rather long post.
~ Dan
<font face=Courier New><SPAN style="color:#007F00">'longhanded method of creating your objects</SPAN>
<SPAN style="color:#00007F">Sub</SPAN> Example1()
<SPAN style="color:#00007F">Set</SPAN> cps = <SPAN style="color:#00007F">New</SPAN> CoursePlanningSystem
<SPAN style="color:#00007F">Dim</SPAN> c <SPAN style="color:#00007F">As</SPAN> Course, u <SPAN style="color:#00007F">As</SPAN> Unit, s <SPAN style="color:#00007F">As</SPAN> Section, p <SPAN style="color:#00007F">As</SPAN> Piece, us <SPAN style="color:#00007F">As</SPAN> Use
<SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> cps.CourseExists("Course 1") <SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#00007F">Set</SPAN> c = cps.AddCourse("Course 1", "Course 1 Description")
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#007F00">'Course 1, Unit 1, Section 1, Piece 1, Use 1</SPAN>
<SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> c.UnitExists("Unit 1") <SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#00007F">Set</SPAN> u = c.AddUnit("Unit 1", "Unit 1 Description", "Comments", 1)
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> u.SectionExists("Section 1") <SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#00007F">Set</SPAN> s = u.AddSection("Section 1", "Line", <SPAN style="color:#00007F">True</SPAN>, <SPAN style="color:#00007F">True</SPAN>, <SPAN style="color:#00007F">True</SPAN>)
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> s.PieceExists("Piece 1") <SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#007F00">' Set p = s.AddPiece("Text", True, Now, Now, #6/7/2006#, Date)</SPAN>
<SPAN style="color:#00007F">Set</SPAN> p = s.AddPiece("Text", <SPAN style="color:#00007F">False</SPAN>)
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> p.UseExists("Use 1") <SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#007F00">' Set us = p.AddUse("Use 1", #6/7/2006#, "Section", "Term", 1)</SPAN>
<SPAN style="color:#00007F">Set</SPAN> us = p.AddUse(Int(Now), "First Period", 1)
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
Debug.Print cps(1).ID
Debug.Print cps(1)(1).ID
Debug.Print cps(1)(1)(1).ID
Debug.Print cps(1)(1)(1)(1).DateCreated
Debug.Print cps(1)(1)(1)(1)(1)(1).ID <SPAN style="color:#007F00">' Why does this line error out?</SPAN>
<SPAN style="color:#007F00">' Object doesn't support this property or method</SPAN>
<SPAN style="color:#007F00">' I think it is related to my attempt to combine date</SPAN>
<SPAN style="color:#007F00">' and section into a Unique ID</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN></FONT>
Here is my modified 'Use' class
<font face=Courier New><SPAN style="color:#00007F">Option</SPAN> <SPAN style="color:#00007F">Explicit</SPAN>
<SPAN style="color:#00007F">Private</SPAN> pDay <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Date</SPAN> <SPAN style="color:#007F00">' Date of Lesson where this Piece was used</SPAN>
<SPAN style="color:#00007F">Private</SPAN> pSection <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN> <SPAN style="color:#007F00">' Section or Period of class where this piece was used</SPAN>
<SPAN style="color:#00007F">Private</SPAN> pOrder <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN> <SPAN style="color:#007F00">' Order of this piece within the Unit.Section (e.g. 1, 2, 3)</SPAN>
<SPAN style="color:#00007F">Private</SPAN> pID <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN> <SPAN style="color:#007F00">' Unique ID for This Piece, specified by combining Use.Section & Use.Day</SPAN>
<SPAN style="color:#00007F">Private</SPAN> pUseComments <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN> <SPAN style="color:#007F00">' Comments about this particular use of the Piece</SPAN>
<SPAN style="color:#00007F">Private</SPAN> pUseText <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN> <SPAN style="color:#007F00">' Generally this is the same as Piece.Text, but can vary</SPAN>
Event RefreshUsesCollection(Instance <SPAN style="color:#00007F">As</SPAN> Use, OldTitle <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>, NewTitle <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>)
<SPAN style="color:#007F00">' ID</SPAN>
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> ID(vID <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>)
RaiseEvent RefreshUsesCollection(Me, pID, vID)
pID = vID
<SPAN style="color:#007F00">' MsgBox "vID = " & vID</SPAN>
<SPAN style="color:#007F00">' MsgBox "ID = " & pID</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> ID() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>
<SPAN style="color:#007F00">' MsgBox "Getting Use ID"</SPAN>
<SPAN style="color:#007F00">' MsgBox ("pID = ") & pID</SPAN>
ID = pID
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">' Day</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> Day(vDay <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Date</SPAN>)
pDay = vDay
ID = UseID
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> Day() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Date</SPAN>
Day = pDay
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">' Section</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> Section(vSection <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>)
pSection = vSection
ID = UseID
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> Section() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>
Section = pSection
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">' Order</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> Order(vOrder <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>)
pOrder = vOrder
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> Order() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
Day = pOrder
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">' UseComments</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> UseComments(vUseComments <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>)
pUseComments = vUseComments
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> UseComments() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
Day = pUseComments
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">' UseText</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> UseText(vUseText <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>)
pUseText = vUseText
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> UseText() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
Day = pUseText
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Function</SPAN> UseID() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>
UseID = pSection & Format(pDay, "0")
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN>
<SPAN style="color:#00007F">Function</SPAN> NewEnum() <SPAN style="color:#00007F">As</SPAN> IUnknown
<SPAN style="color:#00007F">Set</SPAN> NewEnum = pUseCollection.[_NewEnum]
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN>
</FONT>
And my modifcations to the 'Piece' class
<font face=Courier New><SPAN style="color:#00007F">Option</SPAN> <SPAN style="color:#00007F">Explicit</SPAN>
<SPAN style="color:#00007F">Private</SPAN> pUseCollection <SPAN style="color:#00007F">As</SPAN> Collection
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">WithEvents</SPAN> pUse <SPAN style="color:#00007F">As</SPAN> Use
<SPAN style="color:#00007F">Private</SPAN> pID <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>
<SPAN style="color:#00007F">Private</SPAN> pText <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>
<SPAN style="color:#00007F">Private</SPAN> pRetired <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Boolean</SPAN>
<SPAN style="color:#00007F">Private</SPAN> pDateOfLastUse <SPAN style="color:#00007F">As</SPAN> Date
<SPAN style="color:#00007F">Private</SPAN> pDateCreated <SPAN style="color:#00007F">As</SPAN> Date
<SPAN style="color:#00007F">Private</SPAN> pDateLastModified <SPAN style="color:#00007F">As</SPAN> Date
Event RefreshPiecesCollection(Instance <SPAN style="color:#00007F">As</SPAN> Piece, OldTitle <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>, NewTitle <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>)
<SPAN style="color:#007F00">' ID</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> ID(vID <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>) <SPAN style="color:#007F00">'I'd rather this be private, but not sure how to assign Unique ID at runtime?</SPAN>
RaiseEvent RefreshPiecesCollection(Me, pID, vID)
pID = vID
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> ID() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>
ID = pID
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">' Txt</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> Text(vText <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>)
<SPAN style="color:#00007F">If</SPAN> pText <> vText <SPAN style="color:#00007F">Then</SPAN> DateLastModified = Now
pText = vText
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> Text() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>
Text = pText
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">' Retired</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> Retired(vRetired <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Boolean</SPAN>)
pRetired = vRetired
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> Retired() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Boolean</SPAN>
Retired = pRetired
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">' LastUse</SPAN>
<SPAN style="color:#007F00">' I will come back to this later, Perhaps will set value of this property from use object?</SPAN>
<SPAN style="color:#007F00">' Not critical to the initial function of this project</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> DateOfLastUse(vDateOfLastUse <SPAN style="color:#00007F">As</SPAN> Date)
pDateOfLastUse = vDateOfLastUse
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> DateOfLastUse() <SPAN style="color:#00007F">As</SPAN> Date
DateOfLastUse = pDateOfLastUse
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">' Created</SPAN>
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> <SPAN style="color:#00007F">Date</SPAN>Created(vDateCreated <SPAN style="color:#00007F">As</SPAN> Date)
pDateCreated = v<SPAN style="color:#00007F">Date</SPAN>Created
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> DateCreated() <SPAN style="color:#00007F">As</SPAN> Date
DateCreated = pDateCreated
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">' LastModified</SPAN>
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Let</SPAN> DateLastModified(vDateLastModified <SPAN style="color:#00007F">As</SPAN> Date)
pDateLastModified = vDateLastModified
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> DateLastModified() <SPAN style="color:#00007F">As</SPAN> Date
DateLastModified = pDateLastModified
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> Uses(Index <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Variant</SPAN>) <SPAN style="color:#00007F">As</SPAN> Use
<SPAN style="color:#007F00">'you will need to validate the index before using it</SPAN>
<SPAN style="color:#00007F">Set</SPAN> Uses = pUseCollection(Index)
<SPAN style="color:#00007F">Set</SPAN> pUse = Uses
<SPAN style="color:#007F00">' MsgBox "hi"</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">'read only count of Use objects</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Property</SPAN> <SPAN style="color:#00007F">Get</SPAN> UsesCount() <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
UsesCount = pUseCollection.Count
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Property</SPAN>
<SPAN style="color:#007F00">' Add Use</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Function</SPAN> AddUse(Day <SPAN style="color:#00007F">As</SPAN> Date, Section <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>, _
Order <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>) <SPAN style="color:#00007F">As</SPAN> Use
<SPAN style="color:#00007F">If</SPAN> <SPAN style="color:#00007F">Not</SPAN> UseExists(ID) <SPAN style="color:#00007F">Then</SPAN>
<SPAN style="color:#00007F">Dim</SPAN> c <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">New</SPAN> Use
c.Day = Day
c.Section = Section
c.Order = Order
pUseCollection.Add c, c.ID
<SPAN style="color:#00007F">Set</SPAN> AddUse = c
<SPAN style="color:#00007F">Set</SPAN> pUse = c
<SPAN style="color:#00007F">Else</SPAN>
Err.Raise 457, , "This key is already associated with an element of this collection" & vbCr & "The Use, """ & ID & """, already exists..."
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Function</SPAN> RemoveUse(ID <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>) <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Boolean</SPAN>
<SPAN style="color:#00007F">If</SPAN> UseExists(ID) <SPAN style="color:#00007F">Then</SPAN>
pUseCollection.Remove ID
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">If</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN>
<SPAN style="color:#00007F">Public</SPAN> <SPAN style="color:#00007F">Function</SPAN> UseExists(Title <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>) <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Boolean</SPAN>
<SPAN style="color:#00007F">On</SPAN> <SPAN style="color:#00007F">Error</SPAN> <SPAN style="color:#00007F">Resume</SPAN> <SPAN style="color:#00007F">Next</SPAN>
<SPAN style="color:#00007F">Dim</SPAN> c <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">New</SPAN> Use
<SPAN style="color:#00007F">Set</SPAN> c = pUseCollection(Title)
<SPAN style="color:#00007F">If</SPAN> Err.Number <> 0 <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">Function</SPAN>
UseExists = <SPAN style="color:#00007F">True</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN>
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> Class_Initialize()
<SPAN style="color:#00007F">Set</SPAN> pUseCollection = <SPAN style="color:#00007F">New</SPAN> Collection
DateCreated = Int(Now)
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
<SPAN style="color:#00007F">Private</SPAN> <SPAN style="color:#00007F">Sub</SPAN> pUse_RefreshUsesCollection(Instance <SPAN style="color:#00007F">As</SPAN> Use, OldTitle <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>, NewTitle <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">String</SPAN>)
<SPAN style="color:#00007F">Dim</SPAN> SaveIndex <SPAN style="color:#00007F">As</SPAN> <SPAN style="color:#00007F">Integer</SPAN>
<SPAN style="color:#00007F">For</SPAN> SaveIndex = 1 <SPAN style="color:#00007F">To</SPAN> pUseCollection.Count
<SPAN style="color:#00007F">If</SPAN> pUseCollection(SaveIndex).ID = OldTitle <SPAN style="color:#00007F">Then</SPAN> <SPAN style="color:#00007F">Exit</SPAN> <SPAN style="color:#00007F">For</SPAN>
<SPAN style="color:#00007F">Next</SPAN>
pUseCollection.Add Instance, NewTitle, SaveIndex
pUseCollection.Remove SaveIndex
<SPAN style="color:#00007F">Set</SPAN> pUse = <SPAN style="color:#00007F">Nothing</SPAN>
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Sub</SPAN>
<SPAN style="color:#00007F">Function</SPAN> NewEnum() <SPAN style="color:#00007F">As</SPAN> IUnknown
<SPAN style="color:#00007F">Set</SPAN> NewEnum = pUseCollection.[_NewEnum]
<SPAN style="color:#00007F">End</SPAN> <SPAN style="color:#00007F">Function</SPAN></FONT>