I have a program that creates an Excel spreadsheet and creates a line graph on the spreadsheet. It works great except I need to add another line to the graph. How do I do that? Here is the code I use to create everything:
VB Code:
  1. Dim objExcel As Excel.Application
  2. Dim objWorkBook As Excel.Workbook
  3. Dim objWorkSheet As Excel.Worksheet
  4. Dim objXLRange As Excel.Range
  5. Dim objXLChart As Excel.Chart
  6.  
  7. Set objExcel = CreateObject("Excel.Application")
  8. Set objWorkBook = objExcel.Workbooks.Add
  9. Set objWorkSheet = objWorkBook.Worksheets(1)
  10.  
  11. Set objXLRange = objWorkSheet.Range("E2", RangeX)
  12. Set objXLChart = objWorkSheet.Application.Charts.Add
  13. With objXLChart
  14.     .ChartType = xlLine
  15.     .SetSourceData objXLRange, xlColumns
  16. End With

This is not all the code understand, just enough to let you know how I am doing it all.