Topic
1 reply Latest Post - ‏2006-03-15T14:58:26Z by SystemAdmin
SystemAdmin
SystemAdmin
3659 Posts
ACCEPTED ANSWER

Pinned topic Class Diagram Collection Add Method Error

‏2006-03-13T18:14:24Z |
I am trying to create a user-defined class diagram collection by looping through the diagrams attached to use cases but I am getting an error I can't resolve:

I get a run time error of: "Object variable or With block variable not set".

I know that the reference to the diagram within the use cases' diagrams collection is valid. The problem seems to be isolated to the classdiagramcollection's ADD method.

Script excerpt below
=======================

Dim classdiagrams As ClassDiagramCollection
Dim cd As ClassDiagram
Dim ucc As UsecaseCollection
Dim uc As UseCase

' Use Cases
Set ucc = OModel.GetAllusecases ()
' Get all the class diagrams attached to use cases
For i = 1 To ucc.count

' Skip use cases without class diagrams
If ucc.getat(i).ClassDiagrams.count > 0 Then

' loop through the class diagrams in that use case
For j = 1 To ucc.getat(i).ClassDiagrams.count

' **** PROBLEM IS ON THE FOLLOWING LINE ***
classDiagrams.add ucc.getat(i).ClassDiagrams.getat(j)

Next j
End If

Next i
Updated on 2006-03-15T14:58:26Z at 2006-03-15T14:58:26Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    3659 Posts
    ACCEPTED ANSWER

    Re: Class Diagram Collection Add Method Error

    ‏2006-03-15T14:58:26Z  in response to SystemAdmin
    One of my co-workers found the problem.

    The classdiagramCollection needs to be instantiated/initialized using a line of code such as:

    Set classdiagrams = New ClassDiagramCollection