From: Timothy Barnes Date: 2011-08-10T03:31:57+09:00 Subject: Re: Excel chart question --000e0cd312fc3b9b9c04aa16c7fc Content-Type: text/plain; charset=ISO-8859-1 I apologize. I was trying to do things too fast. Below I corrected 2 different ways, both of which worked on my computer. I am using office 2007. That could have some effect. Let me know if the below code doesn't work. Using select: (previously I have mixed up two lines of code 2, 3) excel.Range("A1:A3").select excelchart1 = workbook.Charts.add() worksheet = workbook.Worksheets('Sheet1').select #replace 'Sheet1' with you worksheet name excel.Range("B1:B3").select excelchart2 = workbook.Charts.add() Not using select: (needed to add new method call. range_1 = excel.range("A1:A3") range_2 = excel.range("B1:B3") excelchart1 = workbook.charts.add() excelchart1.setsourcedata(range_1) excelchart2 = workbook.charts.add() excelchart2.setsourcedata(range_2) My full program looks like: require 'win32ole' excel = WIN32OLE.connect('Excel.Application') excel.visible = true workbook = excel.Workbooks.Open('c:\xl_chart.xlsx') excel.Range("A1").Value = 1 excel.Range("A2").Value = 2 excel.Range("A3").Value = 3 excel.Range("B1").Value = 15 excel.Range("B2").Value = 16 excel.Range("B3").Value = 17 #Option 1 #excel.Range("A1:A3").select #excelchart1 = workbook.Charts.add() #worksheet = workbook.Worksheets('Sheet1').select #excel.Range("B1:B3").select #excelchart2 = workbook.Charts.add() #Option 2 range_1 = excel.range("A1:A3") range_2 = excel.range("B1:B3") excelchart1 = workbook.charts.add() excelchart1.setsourcedata(range_1) excelchart2 = workbook.charts.add() excelchart2.setsourcedata(range_2) Timothy --000e0cd312fc3b9b9c04aa16c7fc--