OK, so everything works just fine when I close the chart, it closes/deletes the worksheet/matrix behind the chart. The problem I am having is that if I have an open chart and I close *Origin* then there is something about the sequence of deleted that gives me this error:
"Error: Failed to execute script"
I tried changing it from:
GraphObject goHiddenText = gl.CreateGraphObject(GROT_TEXT);
goHiddenText.Text = ml.GetPage().GetName();
goHiddenText.X = -10000;
string script = "%A=this.text$; win -cd %A";
SetEventScript(goHiddenText, script, GRCT_WINCLOSE);
to:
string script = "%A=this.text$; if (exist(%A)>0) win -cd %A";
But that doesn't help. Any ideas?