Public Shared Sub FormatCharts(ByVal WB As Excel.Workbook) Dim WS As Excel.Worksheet = WB.Sheets(4) Dim oChart As Excel.Chart Dim xlChart As Excel.ChartObjects = WS.ChartObjects Dim myChart As Excel.ChartObject = WB.Charts(1)'this is where the error occurs. I also used WB.Charts("ChartModel") oChart = myChart.Chart With oChart .HasTitle = True .Activate() .Select() If ReportControlForm.txtDupOptModel.Text <> String.Empty Then .ChartTitle.Text = "Device Count by " & ReportControlForm.txtDupOptModel.Text End If End With End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)