Dim oXL As Excel.Application
Dim oWB As Excel.Workbook
Dim oSheet As Excel.Worksheet
Dim oRng As Excel.Range
' Start Excel and get Application object.
oXL = CreateObject("Excel.Application")
oXL.Visible = True
' Get a new workbook.
'oWB = oXL.Workbooks.Add
oWB = oXL.Workbooks.OpenXML(job.Item("JobDir").InnerText & "\" & "vps.submitter." & job.Item("id_job").InnerText & ".xml")
oSheet = oWB.ActiveSheet
Dim rowIndex As Long
Dim DisplCol As Long
Dim ForceCol As Long
Dim startRowIndex As Long
Dim endRowIndex As Long
Dim TLMAXRow As Long
'Misc. code used here to set the column... (ie remove from this example...)
DisplCol = 2
'Misc. code used here to set the row... (ie remove from this example...)
TLMAXRow = 33
'Misc. code used here to set the row... (ie remove from this example...)
startRowIndex = 3
'Misc. code used here to set the row... (ie remove from this example...)
endRowIndex = 83
Dim NewCol As String
Dim NewColRange As String
'the ColumnLetter function is one I wrote to convert a number to a Letter for the Column, ie. 3 = "C"
NewCol = ColumnLetter(DisplCol + 1)
NewColRange = NewCol & ":" & NewCol
'MsgBox("NewCol : " & NewCol & vbCrLf & "NewColRange: " & NewColRange)
oSheet.Range(NewColRange).Insert()
'Misc. code used here to set the column... (ie remove from this example...)
ForceCol = 3
Dim NewChart As Excel.Chart
NewChart = oWB.Charts.Add
NewChart.Activate()
NewChart.ChartType = XlChartType.xlXYScatterSmoothNoMarkers
Dim XValRange As Range
Dim ValRange As Range
XValRange = oSheet.Range(NewCol & startRowIndex, NewCol & endRowIndex)
ValRange = oSheet.Range(ColumnLetter(ForceCol) & startRowIndex, ColumnLetter(ForceCol) & endRowIndex)
Dim serCollect As Excel.Series
serCollect = NewChart.SeriesCollection(1)
Dim vrange As String
Dim xrange As String
vrange = "=" & oSheet.Name & "!R" & startRowIndex & "C" & ForceCol & ":R" & endRowIndex & "C" & ForceCol
MessageBox.Show(vrange)
xrange = "=" & oSheet.Name & "!$" & NewCol & "$" & startRowIndex & ":$" & NewCol & "$" & endRowIndex
MessageBox.Show(xrange)
'Heres where the "FUN" starts... I can't get either of the following lines to work!!!
serCollect.Values = vrange
serCollect.XValues = xrange
'I have also tried:
'serCollect.Values = ValRange
'serCollect.XValues = XValRange
' To NO aval, that didn't work either...
' And I tried:
'serCollect.Values = ValRange.value
'serCollect.XValues = XValRange.value
' Guess what.... that didn't work either...