Charts in VBA

Joined
Jul 26, 2011
Messages
9
Reaction score
0
Hi I have a chart in excel and I want the chart to be displayed into a user form, Im not quite sure where Im going wrong, any help would be greatfull. Below is my code to output the chart.


Private Sub CommandButton1_Click()
Dim FilePathNameOfChart As String, CurrentChart As Object

Set CurrentChart = Sheets(1).ChartObjects(1).Chart

FilePathNameOfChart = Lecture_10 & "\Chart1.gif"

CurrentChart.Export FileName:=FilePathNameOfChart, FilterName:="GIF"

Image1.Picture = LoadPicture(FilePathNameOfChart)



End Sub



Thanks
 
Back
Top