How to declare a global variable in RhinoScript?

Hi all,

I’m currently developing a small script in Rhinoscript.
It is composed of multiple subroutines, that gives me informations about blocks in my model.

Everything is working fine, and for now i’ve been showing the output as a Rhino.CommandHistory and saved as a .txt file.

For bigger models, I would like to directly edit these data in Excel.
To do this, I declare an excel spreadsheet at the beginning of my script, and then in several subroutines, refer to it to insert data in Excel cells.

For now, I’ve been trying to declare my Excel spreadhsset as following :

Dim objXL
Set objXL = CreateObject(“Excel.Application”)

objXL.Visible = True
objXL.WorkBooks.Add

Dim intIndex
intIndex = 1

(The intIndex value is to increment later and go from one Excel line to the next).

It looks like these variables can not be used in my subroutines since it returns an ‘unknown error’.

How can I make these variables to be used in several surboutines ? I’ve been looking for ‘global variables’ in RhinoScript but I don’t find a clear answer.

Thank you,