I have to import 3 graphics to a userform. I even got it, but it started to make mistakes, so I put the code "On Error Resume Next" (but this is not a solution, it just does not lock my form anymore, but it does not do what it should do). At the moment I have the code below:
Sheets("Plan3").Select
On Error Resume Next
Set Grafico = Sheets("Plan3").ChartObjects("Graf").Chart
nome = "C:\Windows\Temp" & Application.PathSeparator & "temp.gif"
Grafico.Export Filename:=nome, Filtername:="GIF"
Imagem1.Picture = LoadPicture(nome)
Sheets("Historico").Select
On Error Resume Next
Set Grafico = Sheets("Historico").ChartObjects("Grafi").Chart
nome = "C:\Windows\Temp" & Application.PathSeparator & "temp.gif"
Grafico.Export Filename:=nome, Filtername:="GIF"
Imagem2.Picture = LoadPicture(nome)
Sheets("KalosG1").Select
On Error Resume Next
Set Grafico = Sheets("KalosG1").ChartObjects("Grafic").Chart
nome = "C:\Windows\Temp" & Application.PathSeparator & "temp.gif"
Grafico.Export Filename:=nome, Filtername:="GIF"
Imagem3.Picture = LoadPicture(nome)
Note: I put "Sheets (" ....). Select "before each" On Error Resume Next "to try to solve, but it did not work. Ps: has hours that works has hours that do not. Sometimes only one of the charts fails ... I have no idea what's wrong.