Hi experts,
I am trying to show a PivotChart in a userform using the code below:
Code
Sub ChangeChart (ChartName As String)
Dim CurrentChart As Chart
Dim FName As String
FName = ThisWorkbook.Path & "\temp.gif"
Set CurrentChart = ThisWorkbook.Sheets("Charts").ChartObjects(ChartName).Chart
CurrentChart.Export Filename:=FName, filtername:="GIF"
frmCharts.imgChart.Picture = LoadPicture(FName)
End Sub
Display More
However, I am getting the below error msg:
Run-time error - The item with the specified name wan't found
I believe I am using the incorrect object (chart) but not sure how to add a pivot chart in the line code.
Appreciate any help.