Chart exporting error

sdoppke

Well-known Member
Joined
Jun 10, 2010
Messages
647
Hi there folks, hoping to get some help with a strange error. I use the below code to export charts as pics. The below code works great but will only do so on 3 of the 7 charts always works for the first 3 then error saving the picture (actually no error saving just save as 0kb empty or corrupt file). When I go to the page with the charts and click into them all one by one (activate them) then works fine.

thanks for any help.

Code:
Private Sub UpdateChart()
    Application.ScreenUpdating = False
    Set CurrentChart = Sheets("Schedule Tool1").ChartObjects(ChartNum).Chart
'   Save chart as GIF
    'Fname = ThisWorkbook.Path & Application.PathSeparator & "Chart.tif"
    Fname = "C:\WINDOWS\Temp" & "Chart.gif"
    CurrentChart.Export Filename:=Fname, FilterName:="GIF"
    Application.ScreenUpdating = False
    
'   Show the chart
    Image1.PictureSizeMode = 1
    On Error Resume Next
    Image1.Picture = LoadPicture(Fname)
End Sub
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,215,338
Messages
6,124,343
Members
449,155
Latest member
ravioli44

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top