Difference between revisions of "Ruby - Excel Constants"
Jump to navigation
Jump to search
PeterHarding (talk | contribs) (Created page with '=Example= <pre> require 'win32ole' module ExcelConsts end excel = WIN32OLE.new("Excel.Application") WIN32OLE.const_load(excel, ExcelConsts) excel.quit() puts 'Matches for: ' ...') |
PeterHarding (talk | contribs) |
||
| Line 20: | Line 20: | ||
[[Category:Ruby]] | [[Category:Ruby]] | ||
[[Category:Microsoft Office Automation]] | |||
Latest revision as of 10:22, 12 March 2010
Example
require 'win32ole'
module ExcelConsts
end
excel = WIN32OLE.new("Excel.Application")
WIN32OLE.const_load(excel, ExcelConsts)
excel.quit()
puts 'Matches for: ' + ARGV[0]
ExcelConsts.constants.each {|const|
match = const.match(/#{ARGV[0]}/)
value = eval("ExcelConsts::#{const}")
puts ' '*4 + const + ' => ' + value.to_s unless match.nil?
}