class Object
Constants
- DisplayAlerts
- Visible
Public Instance Methods
createExcelWorkbook() { |book| ... }
click to toggle source
getAbsolutePath(filename)
click to toggle source
openExcelWorkbook(filename, visible:false, pw:nil) { |book| ... }
click to toggle source
Excelのオープン¶ ↑
# File excel.rb, line 244 def openExcelWorkbook (filename, visible:false, pw:nil) filename = getAbsolutePath(filename) xl = WIN32OLE.new('Excel.Application') xl.Visible = visible xl.DisplayAlerts = true if pw book = xl.Workbooks.Open(:FileName=>"#{filename}",:Password=>pw) else book = xl.Workbooks.Open(filename) end begin yield book ensure xl.Workbooks.Close xl.Quit end end