2

I am trying to access the VBA method 'RGB' via Ruby:

vba ole explorer

The problem is this method belongs to the 'VBA' library not the 'Excel' library. To connect to the Excel library I would do something like this:

require 'win32ole'
xl  = WIN32OLE.new('Excel.Application')    # => opens Excel
xl.visible = true                          # => show it
@wb  = xl.Workbooks.open(excel_file)       # => adds a workbook
@ws = @wb.Worksheets(sheet)                # => open specific sheet

But I do not know how to connect to the VBA library. I've tried:

require 'win32ole'
vba  = WIN32OLE.new('VBA.Application')
vba  = WIN32OLE.new('VBA')

Even better would be if I could somehow programmatically generate a list of all OLE libraries on my computer.

Nathan
  • 412
  • 6
  • 16

1 Answers1

0

I don't know much about the WIN320LE thing, but if I were you, I'd create a vba script, and run that script from the shell via ruby, then pipe the output from that script into ruby as a string.

Not sure if this helps, just a generic pattern

boulder_ruby
  • 38,457
  • 9
  • 79
  • 100