Identify open workbook in excel?

-i have an excel file ex.xls open;
-can i make a script that will search all opened excel files and if an
excel file is ex.xls then ex.xls it will be memorized in an ruby
variable? how can i do that?

tbx

Bulhac M. wrote:

-i have an excel file ex.xls open;
-can i make a script that will search all opened excel files and if an
excel file is ex.xls then ex.xls it will be memorized in an ruby
variable? how can i do that?

tbx

require ‘win32ole’

Connect to a running instance of Excel:

excel = WIN32OLE.connect(‘Excel.Application’)

Select your workbook by name from the Workbooks collection:

my_workbook = excel.Workbooks(‘ex.xls’)

Further discussion here:

David