Chart into Userform Problem
I double checked all Chart Names, even checked what the macor would be
called for each.
I have gone through every thing I can think of and I have tracked down the
porblem to the set currentchart when I changed the UpdateChart Macro
I included a msgbox to see what it was actually referencing. When I ran it
I found that for Chart 2 it was selecting Chart 6
So despite ChartNo =2 it was giving me Chart 6 in the MSgBox anf then Chart
6 would be appearing in the form.
Can anyone tell me why it would be giving me the error as this is totally
beyond me.
Private Sub UpdateChart()
currentchart = ""
testChartName = ""
Set currentchart = Sheets("Charts").ChartObjects(ChartNo).Chart
' CName = currentchart
Dim testChartName As String
testChartName = Sheets("Charts").ChartObjects(ChartNo).Name
MsgBox testChartName
currentchart.Parent.Width = 420
currentchart.Parent.Height = 190
' 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
|