Hi,
With that exact script, I don't see the error. did you run it after you commented out this line?
// string temp$ = wks.longname$; // Run this line to get worksheet long name
If you still do, what version of Origin are you using?
Thanks,
Chris Drozdowski
Originlab Technical Support