The path to a property further down the tree can become rather long, for example:


Lib.Figure.Plot(2).Signal(1).Name="Signal 1"

Lib.Figure.Plot(2).Signal(1).Color = Red

Lib.Figure.Plot(2).Signal(1).Style = Dash


A shortcut can easily be used to greatly simplify the property reference.


Define a reference object


Dim sig as Signal    (or if you need to be less ambiguous due to name conflicts with 'Signal' :  Dim sig as COMforMatLab.Signal )


Set the reference object


Set sig = Lib.Figure.Plot(2).Signal(1)


Now you can use the object reference


sig.Name = "Signal 1"

sig.Color = Red

sig.Style = Dash



Note that most properties can also be read.  One exception would be the Variable property


  Lib.Figure.Plot(2).Signal(1) = sig.Name



Important:

Just be sure that you do not change the current reference without understanding the ramifications.


For instance, if you then reference a different property


Lib.Figure.Plot(3).Signal(4).Name = "Another Signal"


and then go back to using previously defined reference 'sig' you would be referencing Plot(3).Signal(4) not the original Plot(2).Signal(1)