- Inheritance
- < Object
WIN32OLE_TYPE objects represent OLE type libarary information.
Methods
Class
| Visibility | Signature |
|---|---|
| public | new (p1, p2) |
| public | ole_classes (p1) |
| public | progids () |
| public | typelibs () |
Instance
| Visibility | Signature |
|---|---|
| public | guid () |
| public | helpcontext () |
| public | helpfile () |
| public | helpstring () |
| public | major_version () |
| public | minor_version () |
| public | name () |
| public | ole_methods (...) |
| public | ole_type () |
| public | progid () |
| public | src_type () |
| public | to_s () |
| public | typekind () |
| public | variables () |
| public | visible? () |
Class Method Detail
WIN32OLE_TYPE.new(typelib, ole_class) → WIN32OLE_TYPE object
Returns a new WIN32OLE_TYPE object. The first argument typelib specifies OLE type library name. The second argument specifies OLE class name.
WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
# => WIN32OLE_TYPE object of Application class of Excel.
WIN32OLE_TYPE.ole_classes(typelib)
Returns array of WIN32OLE_TYPE objects defined by the typelib type library.
WIN32OLE_TYPE.progids
Returns array of ProgID.
WIN32OLE_TYPE.typelibs
Returns array of type libraries.
Instance Method Detail
WIN32OLE_TYPE#guid #=> GUID
Returns GUID.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.guid # => {00024500-0000-0000-C000-000000000046}
WIN32OLE_TYPE#helpcontext
Returns helpcontext. If helpcontext is not found, then returns nil.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
puts tobj.helpfile # => 131185
WIN32OLE_TYPE#helpfile
Returns helpfile path. If helpfile is not found, then returns nil.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
puts tobj.helpfile # => C:\...\VBAXL9.CHM
WIN32OLE_TYPE#helpstring #=> help string.
Returns help string.
tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser')
puts tobj.helpstring # => Web Browser interface
WIN32OLE_TYPE#major_version
Returns major version.
tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
puts tobj.major_version # => 8
WIN32OLE_TYPE#minor_version #=> OLE minor version
Returns minor version.
tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
puts tobj.minor_version # => 2
WIN32OLE_TYPE#name #=> OLE type name
Returns OLE type name.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.name # => Application
WIN32OLE_TYPE#ole_methods # the array of WIN32OLE_METHOD objects.
Returns array of WIN32OLE_METHOD objects which represent OLE method defined in OLE type library.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Worksheet')
methods = tobj.ole_methods.collect{|m|
m.name
}
# => ['Activate', 'Copy', 'Delete',....]
WIN32OLE_TYPE#ole_type #=> OLE type string.
returns type of OLE class.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.ole_type # => Class
WIN32OLE_TYPE#progid #=> ProgID
Returns ProgID if it exists. If not found, then returns nil.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.progid # => Excel.Application.9
WIN32OLE_TYPE#src_type #=> OLE source class
Returns source class when the OLE class is ‘Alias’.
tobj = WIN32OLE_TYPE.new('Microsoft Office 9.0 Object Library', 'MsoRGBType')
puts tobj.src_type # => I4
to_s()
Alias for name
WIN32OLE_TYPE#typekind #=> number of type.
Returns number which represents type.
tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
puts tobj.typekind # => 4
WIN32OLE_TYPE#variables
Returns array of WIN32OLE_VARIABLE objects which represent variables defined in OLE class.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
vars = tobj.variables
vars.each do |v|
puts "#{v.name} = #{v.value}"
end
The result of above sample script is follows:
xlChart = -4109
xlDialogSheet = -4116
xlExcel4IntlMacroSheet = 4
xlExcel4MacroSheet = 3
xlWorksheet = -4167
WIN32OLE_TYPE#visible #=> true or false
Returns true if the OLE class is public.
tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.visible # => true