Thanks, that's really handy. Just an FYI, I figured out the #to_clr_string when going through the documentation on IronRuby.net which is currently reporting the following error anywhere I assume you mean to have code:
reference to undefined name 'syntax' On Fri, Feb 19, 2010 at 11:10 AM, Jim Deville <jdevi...@microsoft.com> wrote: > Just so you know, the WIN32OLE library wraps the COM initialization and > removes the need for to_clr_string. > > Require 'win32ole' > WIN32OLE.new 'Excel.Application' > > > This will also be cross compatible with MRI. > > Tomas: Can we make Shane's case work without requiring the cast to CLR string? > > JD > > > > -----Original Message----- > From: Shane Emmons <semmon...@gmail.com> > Sent: Friday, February 19, 2010 7:02 AM > To: ironruby-core@rubyforge.org <ironruby-core@rubyforge.org> > Subject: Re: [Ironruby-core] COM Interop Problem > > > On Thu, Feb 18, 2010 at 3:42 PM, Shane Emmons <semmon...@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 > _______________________________________________ > Ironruby-core mailing list > Ironruby-core@rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core@rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > -- Shane Emmons _______________________________________________ Ironruby-core mailing list Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core