views:

10

answers:

1

When I try and call any method on a COM Object that takes one or more arguments, I get the following error on the last argument:

Could not convert argument 0 for call to Open. (ArgumentError)

Everything works fine when calling a method that takes no arguments, or getting/setting a property. Here is the code that gives me the error above:

def new_com_object(prog_id)
  System::Activator.CreateInstance(System::Type.GetTypeFromProgID(prog_id))
end

xls = new_com_object('Excel.Application')
xls.Visible = true
xls.Workbooks.Open('c:\\Book1.xls')
A: 

Looks like I need to use String#to_clr_string when calling methods. Right now IronRuby.net documentation is borked, so it's hard to figure that out.

semmons99