From: "Thomas B." Date: 2008-10-13T02:57:52+09:00 Subject: Re: why the object doesn't respond to its method? Li Chen wrote: > Hi all, > > I want to find out if an object responses to a method. while I can tell > that the excel object(in this script) responses to method 'Visible or > visible', my codes DO NOT come true. Any idea? Hello. First, in your code you actually do not call the method Visible, you call the method Visible= and it's a big difference, generally. But you won't find the method Visible= neither, as, as said above, the capitalised ole methods are handled by method_missing. You can see a list of ole methods like this: excel.ole_methods This gives an array of all the methods, where you can see Visible twice, once it is the method Visible and once Visible=, but you cannot tell one from another at a glance. To get just a list of, say, setters, to find the method Visible=, you write excel.ole_put_methods, and to get a list of getters (or probably other methods, but with exclusion of setters) you write excel.ole_get_methods. Now there's one more problem - the list doesn't contain strings, but WIN32OLE_METHOD objects. I do not actually know how to handle this, but this is how you can check if Visible= is among the methods of the object: excel.ole_put_methods.find{|m| m.name=="Visible"} The above line returns nil iff excel does not respond to Visible=. TPR. -- Posted via http://www.ruby-forum.com/.