Unanswered: Function only works on object array?!?! Help!
I've got this sub for creating charts that only seems to work on a chart array...not on a single chart.
Here's the sub:
Public Sub CreateXLChart(xlSheetF As Excel.Worksheet, xlChartF As Excel.Chart, RowNum As Integer, _
ChartType As String, ReportName As String)
.ChartType = ChartType
.SetSourceData xlSheetF.Cells(RowNum, 1).CurrentRegion
.PlotBy = xlColumns
.Location xlLocationAsObject, ReportName
Here's how it's being called:
Set xlChart = xlApp.Charts.Add
Call CreateXLChart(xlSheet, xlChart, 4, xlLineMarkers, "Report")
Here's the error I'm getting:
Run-time error '1004': Method 'Location' of object '_Chart' failed
I've googled this but can't find a solution. This sub works absolutely fine when I'm working with an array of chart objects, but not when I'm working with a plain regular chart object. I do everything the same way except one's an array and one's not.