Some time ago, I wrote a macro to display a chart in a new window. It works great in Excel Version 2002 (XP), but I can't get it to work in Excel 2010. The error I am getting says:
Run-Time error '-2147467259 (80004005)'
Method 'ChartType' of object '_Chart' failed
The error occurs on the line which is: CurrentChart.ChartType = chtype
Here is my macro code:
I'm a very novice vba user, but am in need of getting this to work in the new 2010 version. Any help would be much appreciated.
Run-Time error '-2147467259 (80004005)'
Method 'ChartType' of object '_Chart' failed
The error occurs on the line which is: CurrentChart.ChartType = chtype
Here is my macro code:
Code:
Private Sub UpdateChart(chtype)
YR = Worksheets("TITLE").Cells(8, 10)
Set CurrentChart = Sheets("REPORTS").ChartObjects(1).Chart
CurrentChart.ChartTitle.Characters.Text = YR & " ABC Membership By Class"
CurrentChart.ChartType = chtype
' Save chart as GIF
fName = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
CurrentChart.Export Filename:=fName, FilterName:="GIF"
' Show the chart
Image1.Picture = LoadPicture(fName)
End Sub
I'm a very novice vba user, but am in need of getting this to work in the new 2010 version. Any help would be much appreciated.