Class: WIN32OLE_TYPE

Inherits:
Object
  • Object
show all
Defined in:
win32ole.c,
win32ole.c

Overview

WIN32OLE_TYPE objects represent OLE type libarary information.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#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.


3513
3514
3515
# File 'win32ole.c', line 3513

static VALUE
foletype_initialize(self, typelib, oleclass)
VALUE self;

Class Method Details

.ole_classes(typelib) ⇒ Object

Returns array of WIN32OLE_TYPE objects defined by the typelib type library.



3318
3319
3320
# File 'win32ole.c', line 3318

static VALUE
foletype_s_ole_classes(self, typelib)
VALUE self;

.progidsObject

Returns array of ProgID.



3403
3404
3405
# File 'win32ole.c', line 3403

static VALUE
foletype_s_progids(self)
VALUE self;

.typelibsObject

Returns array of type libraries.



3355
3356
3357
# File 'win32ole.c', line 3355

static VALUE
foletype_s_typelibs(self)
VALUE self;

Instance Method Details

#guidObject

Returns GUID.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.guid  # => {00024500-0000-0000-C000-000000000046}


3651
3652
3653
# File 'win32ole.c', line 3651

static VALUE
foletype_guid(self)
VALUE self;

#helpcontextObject

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


3950
3951
3952
# File 'win32ole.c', line 3950

static VALUE
foletype_helpcontext(self)
VALUE self;

#helpfileObject

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


3920
3921
3922
# File 'win32ole.c', line 3920

static VALUE
foletype_helpfile(self)
VALUE self;

#helpstringObject

Returns help string.

tobj = WIN32OLE_TYPE.new('Microsoft Internet Controls', 'IWebBrowser')
puts tobj.helpstring # => Web Browser interface


3852
3853
3854
# File 'win32ole.c', line 3852

static VALUE 
foletype_helpstring(self)
VALUE self;

#major_versionObject

Returns major version.

tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
puts tobj.major_version # => 8


3757
3758
3759
# File 'win32ole.c', line 3757

static VALUE
foletype_major_version(self)
VALUE self;

#minor_versionObject

Returns minor version.

tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
puts tobj.minor_version # => 2


3789
3790
3791
# File 'win32ole.c', line 3789

static VALUE
foletype_minor_version(self)
VALUE self;

#nameObject Also known as: to_s

Returns OLE type name.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.name  # => Application


3552
3553
3554
# File 'win32ole.c', line 3552

static VALUE
foletype_name(self)
VALUE self;

#ole_methodsObject

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',....]


4045
4046
4047
# File 'win32ole.c', line 4045

static VALUE
foletype_methods(argc, argv, self)
int argc;

#ole_typeObject

returns type of OLE class.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.ole_type  # => Class


3614
3615
3616
# File 'win32ole.c', line 3614

static VALUE
foletype_ole_type(self)
VALUE self;

#progidObject

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


3688
3689
3690
# File 'win32ole.c', line 3688

static VALUE
foletype_progid(self)
VALUE self;

#src_typeObject

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


3889
3890
3891
# File 'win32ole.c', line 3889

static VALUE
foletype_src_type(self)
VALUE self;

#typekindObject

Returns number which represents type.

tobj = WIN32OLE_TYPE.new('Microsoft Word 10.0 Object Library', 'Documents')
puts tobj.typekind # => 4


3822
3823
3824
# File 'win32ole.c', line 3822

static VALUE 
foletype_typekind(self)
VALUE self;

#variablesObject

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


4024
4025
4026
# File 'win32ole.c', line 4024

static VALUE
foletype_variables(self)
VALUE self;

#visible?Boolean

Returns true if the OLE class is public.

tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'Application')
puts tobj.visible  # => true

Returns:

  • (Boolean)


3725
3726
3727
# File 'win32ole.c', line 3725

static VALUE
foletype_visible(self)
VALUE self;