class WIN32OLE::Variant

WIN32OLE::Variant 对象表示 OLE 变体。

当调用 OLE 方法时,Win32OLE 会自动将 Ruby 对象转换为 OLE 变体。如果 OLE 方法需要的参数与 Win32OLE 自动转换的变体不同,你可以使用 WIN32OLE::Variant 类来转换指定的变体类型。

param = WIN32OLE::Variant.new(10, WIN32OLE::VARIANT::VT_R4)
oleobj.method(param)

WIN32OLE::Variant 不支持 VT_RECORD 变体。如果需要 VT_RECORD 变体,请使用 WIN32OLE::Record 类,而不是 WIN32OLE::Variant