Class: WIN32OLE_VARIABLE

Class | WIN32OLE_VARIABLE
In: | win32ole/win32ole.c
Parent: | Object

`WIN32OLE_VARIABLE` objects represent OLE variable information.

### Methods

name ole_type ole_type_detail to_s value variable_kind varkind visible?

### Public Instance methods

WIN32OLE_VARIABLE#name

Returns the name of variable.

       tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
       variables = tobj.variables
       variables.each do |variable|
         puts "#{variable.name}"
       end

       The result of above script is following:
         xlChart
         xlDialogSheet
         xlExcel4IntlMacroSheet
         xlExcel4MacroSheet
         xlWorksheet

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_VARIABLE#name
     *
     *  Returns the name of variable.
     *
     *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
     *     variables = tobj.variables
     *     variables.each do |variable|
     *       puts "#{variable.name}"
     *     end
     *
     *     The result of above script is following:
     *       xlChart
     *       xlDialogSheet
     *       xlExcel4IntlMacroSheet
     *       xlExcel4MacroSheet
     *       xlWorksheet
     *
     */
    static VALUE
    folevariable_name(self)
        VALUE self;
    {
        return rb_ivar_get(self, rb_intern("name"));
    }

WIN32OLE_VARIABLE#ole_type

Returns OLE type string.

      tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
      variables = tobj.variables
      variables.each do |variable|
        puts "#{variable.ole_type} #{variable.name}"
      end

      The result of above script is following:
        INT xlChart
        INT xlDialogSheet
        INT xlExcel4IntlMacroSheet
        INT xlExcel4MacroSheet
        INT xlWorksheet

[Source]

    /*
     *   call-seq:
     *      WIN32OLE_VARIABLE#ole_type
     *
     *   Returns OLE type string.
     *
     *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
     *     variables = tobj.variables
     *     variables.each do |variable|
     *       puts "#{variable.ole_type} #{variable.name}"
     *     end
     *
     *     The result of above script is following:
     *       INT xlChart
     *       INT xlDialogSheet
     *       INT xlExcel4IntlMacroSheet
     *       INT xlExcel4MacroSheet
     *       INT xlWorksheet
     *
     */
    static VALUE
    folevariable_ole_type(self)
        VALUE self;
    {
        struct olevariabledata *pvar;
        Data_Get_Struct(self, struct olevariabledata, pvar);
        return ole_variable_ole_type(pvar->pTypeInfo, pvar->index);
    }

WIN32OLE_VARIABLE#ole_type_detail

Returns detail information of type. The information is array of type.

       tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', 'D3DCLIPSTATUS')
       variable = tobj.variables.find {|variable| variable.name == 'lFlags'}
       tdetail  = variable.ole_type_detail
       p tdetail # => ["USERDEFINED", "CONST_D3DCLIPSTATUSFLAGS"]

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_VARIABLE#ole_type_detail
     *
     *  Returns detail information of type. The information is array of type.
     *
     *     tobj = WIN32OLE_TYPE.new('DirectX 7 for Visual Basic Type Library', 'D3DCLIPSTATUS')
     *     variable = tobj.variables.find {|variable| variable.name == 'lFlags'}
     *     tdetail  = variable.ole_type_detail
     *     p tdetail # => ["USERDEFINED", "CONST_D3DCLIPSTATUSFLAGS"]
     *
     */
    static VALUE
    folevariable_ole_type_detail(self)
        VALUE self;
    {
        struct olevariabledata *pvar;
        Data_Get_Struct(self, struct olevariabledata, pvar);
        return ole_variable_ole_type_detail(pvar->pTypeInfo, pvar->index);
    }

to_s()

Alias for name

WIN32OLE_VARIABLE#value

Returns value if value is exists. If the value does not exist, this method returns nil.

       tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
       variables = tobj.variables
       variables.each do |variable|
         puts "#{variable.name} = #{variable.value}"
       end

       The result of above script is following:
         xlChart = -4109
         xlDialogSheet = -4116
         xlExcel4IntlMacroSheet = 4
         xlExcel4MacroSheet = 3
         xlWorksheet = -4167

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_VARIABLE#value
     *
     *  Returns value if value is exists. If the value does not exist,
     *  this method returns nil.
     *
     *     tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
     *     variables = tobj.variables
     *     variables.each do |variable|
     *       puts "#{variable.name} = #{variable.value}"
     *     end
     *
     *     The result of above script is following:
     *       xlChart = -4109
     *       xlDialogSheet = -4116
     *       xlExcel4IntlMacroSheet = 4
     *       xlExcel4MacroSheet = 3
     *       xlWorksheet = -4167
     *
     */
    static VALUE
    folevariable_value(self)
        VALUE self;
    {
        struct olevariabledata *pvar;
        Data_Get_Struct(self, struct olevariabledata, pvar);
        return ole_variable_value(pvar->pTypeInfo, pvar->index);
    }

WIN32OLE_VARIABLE#variable_kind

Returns variable kind string.

       tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
       variables = tobj.variables
       variables.each do |variable|
         puts "#{variable.name} #{variable.variable_kind}"
       end

       The result of above script is following:
         xlChart CONSTANT
         xlDialogSheet CONSTANT
         xlExcel4IntlMacroSheet CONSTANT
         xlExcel4MacroSheet CONSTANT
         xlWorksheet CONSTANT

[Source]

    /*
     * call-seq:
     *   WIN32OLE_VARIABLE#variable_kind
     *
     * Returns variable kind string.
     *
     *    tobj = WIN32OLE_TYPE.new('Microsoft Excel 9.0 Object Library', 'XlSheetType')
     *    variables = tobj.variables
     *    variables.each do |variable|
     *      puts "#{variable.name} #{variable.variable_kind}"
     *    end
     *
     *    The result of above script is following:
     *      xlChart CONSTANT
     *      xlDialogSheet CONSTANT
     *      xlExcel4IntlMacroSheet CONSTANT
     *      xlExcel4MacroSheet CONSTANT
     *      xlWorksheet CONSTANT
     */
    static VALUE
    folevariable_variable_kind(self)
        VALUE self;
    {
        struct olevariabledata *pvar;
        Data_Get_Struct(self, struct olevariabledata, pvar);
        return ole_variable_kind(pvar->pTypeInfo, pvar->index);
    }

WIN32OLE_VARIABLE#varkind

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

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_VARIABLE#varkind
     *
     *  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
     */
    static VALUE
    folevariable_varkind(self)
        VALUE self;
    {
        struct olevariabledata *pvar;
        Data_Get_Struct(self, struct olevariabledata, pvar);
        return ole_variable_varkind(pvar->pTypeInfo, pvar->index);
    }

WIN32OLE_VARIABLE#visible?

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

[Source]

    /*
     *  call-seq:
     *     WIN32OLE_VARIABLE#visible?
     *
     *  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
     *
     */
    static VALUE
    folevariable_visible(self)
        VALUE self;
    {
        struct olevariabledata *pvar;
        Data_Get_Struct(self, struct olevariabledata, pvar);
        return ole_variable_visible(pvar->pTypeInfo, pvar->index);
    }

[Validate]