Hi
I have some data that is translated into 4 charts. I would like to place the charts on a UserForm. Thw way to do this is by saving the file as a GIF and loading it into a UserForm as a picture. The code below works once (if the ' are taken out) however upon opening Excel the next time crashes Excel completely.
I have ' out all but one chart and that works fine. It is only when I try and do two or more.
Please could one you geniuses let me know what I have done wrong?
Sub Refresh()
'Refresh everything
Application.ScreenUpdating = False
Calculate
'Copy Feed range to Data to chart range
Range("I6:I9").Value = Range("C6:C9").Value
Range("K6:M9").Value = Range("D6:F9").Value
'Save the images
Set CurrentChartF = Sheets("Sheet1").ChartObjects("Fire").Chart
Set CurrentChartP = Sheets("Sheet1").ChartObjects("PA").Chart
Set CurrentChartI = Sheets("Sheet1").ChartObjects("Intruder").Chart
Set CurrentChartC = Sheets("Sheet1").ChartObjects("CCTV").Chart
' Save chart as GIF
Fname = ThisWorkbook.Path & Application.PathSeparator & "Fire.gif"
CurrentChartF.Export Filename:=Fname, FilterName:="GIF"
UserForm1.Fire.Picture = LoadPicture(Fname)
' Fname = ThisWorkbook.Path & Application.PathSeparator & "PA.gif"
'CurrentChartP.Export Filename:=Fname, FilterName:="GIF"
' UserForm1.PA.Picture = LoadPicture(Fname)
' Fname = ThisWorkbook.Path & Application.PathSeparator & "Intruder.gif"
'CurrentChartI.Export Filename:=Fname, FilterName:="GIF"
' UserForm1.Intruder.Picture = LoadPicture(Fname)
' Fname = ThisWorkbook.Path & Application.PathSeparator & "CCTV.gif"
' CurrentChartC.Export Filename:=Fname, FilterName:="GIF"
' UserForm1.CCTV.Picture = LoadPicture(Fname)
ActiveWorkbook.RefreshAll
Application.ScreenUpdating = True
Bookmarks