Save Chart1 as a GIF, then load it into a userform (NRPMH).
Here is the code that is not working, run time error '13'.
Code: Select all
Private Sub UserForm_Initialize()
Dim chart As chart
Dim fname As String
Dim ws As Worksheets
Set ws = Worksheets("Charts")
Application.ScreenUpdating = False
Set chart = ActiveSheet.Shapes.Chart1
' Save chart as GIF
fname = ThisWorkbook.Path & Application.PathSeparator & "temp.gif"
chart.Export Filename:=fname, filterName:="GIF"
Application.ScreenUpdating = True
Chart1.Image1.Picture = LoadPicture(fname)