Topic
  • 2 replies
  • Latest Post - ‏2014-04-29T16:35:11Z by jvogel-11
jvogel-11
jvogel-11
51 Posts

Pinned topic VBA: How to add to the SAObjects array?

‏2014-02-25T20:21:41Z |

 I begin by populating an saObject array called myOV6cDiagrams, and then I do some processing and intend to add additional diagrams to that array, but doesnt seem to work.  I have the following code:

Dim myOv6cDiagrams as SA2001.SAObjects

Dim myTempDiagram As SA2001.Diagram

Dim saSymbol As SA2001.Symbol

set myOV6cDiagrams = saSymbol.GetChildDiagrams

myOv6cDiagrams.readall

If myOv6cDiagrams.count = 2 then

   Set myTempDiagram = SA2001.Application.Encyclopedia.CreateDiagram("Temp", 102)

   myTempDiagram.save

  'the following code doesnt work and causes an error, but is where I would like to add a third diagram to the list of two diagrams already in the myOv6cDiagrams group/array of objects. It is probably something simple, but it escapes me: 

  Set myOv6cDiagrams.Item(3) = myTempDiagram

End If

  • DavidNRice
    DavidNRice
    5 Posts
    ACCEPTED ANSWER

    Re: VBA: How to add to the SAObjects array?

    ‏2014-04-28T21:13:13Z  

    Hi,

    The SAObjects does not have an add method.  It is necessary to add the created diagram to the symbol as a child diagram directly vs. adding in this manner.

    I hope this helps.

  • DavidNRice
    DavidNRice
    5 Posts

    Re: VBA: How to add to the SAObjects array?

    ‏2014-04-28T21:13:13Z  

    Hi,

    The SAObjects does not have an add method.  It is necessary to add the created diagram to the symbol as a child diagram directly vs. adding in this manner.

    I hope this helps.

  • jvogel-11
    jvogel-11
    51 Posts

    Re: VBA: How to add to the SAObjects array?

    ‏2014-04-29T16:35:11Z  

    Hi,

    The SAObjects does not have an add method.  It is necessary to add the created diagram to the symbol as a child diagram directly vs. adding in this manner.

    I hope this helps.

    Thank you David, and this makes sense - I will have to give this a try.