WIN32OLE::Method objects represent OLE method information.

Class Methods

Returns a new WIN32OLE::Method object which represents the information about OLE method. The first argument ole_type specifies WIN32OLE::Type object. The second argument method specifies OLE method name defined OLE class which represents WIN32OLE::Type object.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE::Method.new(tobj, 'SaveAs')
Instance Methods

Returns dispatch ID.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.dispid # => 181

Returns true if the method is event.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE::Method.new(tobj, 'SheetActivate')
puts method.event? # => true

Returns event interface name if the method is event.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE::Method.new(tobj, 'SheetActivate')
puts method.event_interface # =>  WorkbookEvents

Returns help context.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.helpcontext # => 65717

Returns help file. If help file is not found, then the method returns nil.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.helpfile # => C:\...\VBAXL9.CHM

Returns help string of OLE method. If the help string is not found, then the method returns nil.

tobj = WIN32OLE::Type.new('Microsoft Internet Controls', 'IWebBrowser')
method = WIN32OLE::Method.new(tobj, 'Navigate')
puts method.helpstring # => Navigates to a URL or file.

Returns the method name with class name.

Returns the method invoke kind.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.invkind # => 1

Returns the method kind string. The string is “UNKNOWN” or “PROPERTY” or “PROPERTY” or “PROPERTYGET” or “PROPERTYPUT” or “PROPERTYPPUTREF” or “FUNC”.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.invoke_kind # => "FUNC"

Returns the name of the method.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE::Method.new(tobj, 'SaveAs')
puts method.name # => SaveAs

Returns the offset ov VTBL.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.offset_vtbl # => 40

returns array of WIN32OLE::Param object corresponding with method parameters.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE::Method.new(tobj, 'SaveAs')
p method.params # => [Filename, FileFormat, Password, WriteResPassword,
                      ReadOnlyRecommended, CreateBackup, AccessMode,
                      ConflictResolution, AddToMru, TextCodepage,
                      TextVisualLayout]

Returns string of return value type of method.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.return_type # => Workbook

Returns detail information of return value type of method. The information is array.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
p method.return_type_detail # => ["PTR", "USERDEFINED", "Workbook"]

Returns number of return value type of method.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.return_vtype # => 26

Returns the size of optional parameters.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE::Method.new(tobj, 'SaveAs')
puts method.size_opt_params # => 4

Returns the size of arguments of the method.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbook')
method = WIN32OLE::Method.new(tobj, 'SaveAs')
puts method.size_params # => 11
An alias for name

Returns true if the method is public.

tobj = WIN32OLE::Type.new('Microsoft Excel 9.0 Object Library', 'Workbooks')
method = WIN32OLE::Method.new(tobj, 'Add')
puts method.visible? # => true