08/11/21 04:46:10
そりゃダメだ。fileって変数がないぞう。
あと引数に代入しても、それはローカル変数だから意味がないよ。
def new_excel(file)
excel = WIN32OLE.new('Excel.Application')
excel.visible = false
excel.displayAlerts = false
excel.workbooks.open(file)
workbook = excel.workbooks(1)
sheet = workbook.sheets(1)
return excel, workbook, sheet
end
excel, workbook, sheet = new_excel()