create

create(canvas, *args) Class Public methods

vartype

WIN32OLE_VARIANT.vartype #=> OLE variant type. Instance Public methods Returns OLE variant type. obj = WIN32OLE_VARIANT.new("string") obj.vartype # => WIN32OLE::VARIANT::VT_BSTR

value=

WIN32OLE_VARIANT.value = val #=> set WIN32OLE_VARIANT value to val. Instance Public methods Sets variant value to val. If the val type does not match variant value type(vartype), then val is changed to match variant value type(vartype) before setting val. Thie method is not available when vartype is VT_ARRAY(except VT_UI1|VT_ARRAY). If the vartype is VT_UI1|VT_ARRAY, the val should be String object. obj = WIN32OLE_VARIANT.new(1) # obj.vartype is WIN32OLE::VARIANT::VT_I4 obj.val

value

WIN32OLE_VARIANT.value #=> Ruby object. Instance Public methods Returns Ruby object value from OLE variant. obj = WIN32OLE_VARIANT.new(1, WIN32OLE::VARIANT::VT_BSTR) obj.value # => "1" (not Fixnum object, but String object "1")

[]=

WIN32OLE_VARIANT[i,j,...] = val #=> set the element of OLE array Instance Public methods Set the element of WIN32OLE_VARIANT object(OLE array) to val. This method is available only when the variant type of WIN32OLE_VARIANT object is VT_ARRAY. REMARK: The all indicies should be 0 or natural number and lower than or equal to max indicies. (This point is different with Ruby Array indicies.) obj = WIN32OLE_VARIANT.new([[1,2,3],[4,5,6]]) obj[0,0] = 7 obj[1,0] = 8 p obj.value # =>

[]

WIN32OLE_VARIANT[i,j,...] #=> element of OLE array. Instance Public methods Returns the element of WIN32OLE_VARIANT object(OLE array). This method is available only when the variant type of WIN32OLE_VARIANT object is VT_ARRAY. REMARK: The all indicies should be 0 or natural number and lower than or equal to max indicies. (This point is different with Ruby Array indicies.) obj = WIN32OLE_VARIANT.new([[1,2,3],[4,5,6]]) p obj[0,0] # => 1 p obj[1,0] # => 4 p obj[2,0] # =>

new

WIN32OLE_VARIANT.new(val, vartype) #=> WIN32OLE_VARIANT object. Class Public methods Returns Ruby object wrapping OLE variant. The first argument specifies Ruby object to convert OLE variant variable. The second argument specifies VARIANT type. In some situation, you need the WIN32OLE_VARIANT object to pass OLE method shell = WIN32OLE.new("Shell.Application") folder = shell.NameSpace("C:\\Windows") item = folder.ParseName("tmp.txt") # You can't use Ruby String object to call Fo

array

WIN32OLE_VARIANT.array(ary, vt) Class Public methods Returns Ruby object wrapping OLE variant whose variant type is VT_ARRAY. The first argument should be Array object which specifies dimensions and each size of dimensions of OLE array. The second argument specifies variant type of the element of OLE array. The following create 2 dimensions OLE array. The first dimensions size is 3, and the second is 4. ole_ary = WIN32OLE_VARIANT.array([3,4], VT_I4) ruby_ary = ole_ary.value # =>

visible?

WIN32OLE_VARIABLE#visible? Instance Public methods Returns true if the variable is public. tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.name} #{variable.visible?}" end The result of above script is following: xlChart true xlDialogSheet true xlExcel4IntlMacroSheet true xlExcel4MacroSheet true xlWorksheet true

varkind

WIN32OLE_VARIABLE#varkind Instance Public methods Returns the number which represents variable kind. tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType') variables = tobj.variables variables.each do |variable| puts "#{variable.name} #{variable.varkind}" end The result of above script is following: xlChart 2 xlDialogSheet 2 xlExcel4IntlMacroSheet 2 xlExcel4MacroSheet 2 xlWorksheet 2