From: Li Chen Date: 2006-12-01T13:04:30+09:00 Subject: How to get value of constants in Excel using WIN32OLE Hi all, I have a script to store all Excel constants in an array. ButI can't return the value for each constant. By using "inspect" method I think all the constants in the array are turn into a string. The only chance I can get the value of a constant is that I run the script to print out all the constants and then add a line outside the array puts Excel_Const::XlYDMFormat => return a value of 8 which is so inefficient! I also notice that the line below will return a string puts "Excel_Const::XlYDMFormat" => return a string as Excel_Const::XlYDMFormat I want to print out the values for all the constants at once. I wonder if any expert out there can give me a hand. Thank you in advnace, Li ###### equire 'win32ole' require 'enumerator' module Excel_Const end excel=WIN32OLE.new('Excel.Application') WIN32OLE.const_load(excel, Excel_Const) array=Array.new Excel_Const.constants.each{|c| array<ruby consts.rb "Excel_Const::CONSTANTS" "Excel_Const::Xl24HourClock" "Excel_Const::Xl3DArea" "Excel_Const::Xl3DAreaStacked" ... "Excel_Const::XlYDMFormat" ... The value is 8 The total constants are 1387 >Exit code: 0 -- Posted via http://www.ruby-forum.com/.