[Ironruby-core] COM Interop Problem

Shane Emmons semmons99 at gmail.com
Fri Feb 19 09:53:56 EST 2010


On Thu, Feb 18, 2010 at 3:42 PM, Shane Emmons <semmons99 at gmail.com> wrote:
> Anytime I invoke a method on a COM object with one or more arguments,
> I get the following error:
>  Could not convert argument 0 for call to Open. (ArgumentError)
>
> What's preplexing is the argument number is always the last argument,
> so if there are four arguments, the error will be on argument 3. Here
> is an example script that gives 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')
>
> --
> Shane Emmons
>

I figured it out, needed to to String#to_clr_string on every argument.

-- 
Shane Emmons


More information about the Ironruby-core mailing list