Is is possible in Ruby to instantiate WIN32OLE objects that are returned
by a method call on other WIN32OLE objects?
The situation is the following. There is a
OLE (COM) object (for communicating with a Navision ERP system). It has
a CreateoutMessage (yes, misspelled, it’s Microsoft, so don’t be
surprised) method that returns another OLE object (a message object). So
So I do
cc2 = WIN32OLE.new(“NsComCom2.CommunicationComponent”)
and it works fine.
now, I would try to
msg = cc2.CreateoutMessage(“Message queue://.\private$\NIF”)
and it does something but it does not instantiate the right object in
the msg variable, because the methods I’d expect msg to have are not
available. Yes, I know there are some casing quirks, so I tried
createoutMessage, createoutmessage, create_out_message, createOutMessage
and whatever, but it never worked. mgs.class just returns WIN32OLE.
An Excel example will just do fine - say, call a method on a Sheet that
returns a Range object into a variable, and then call some method of the
Range object instance.