Hello all,
I'm having an issue with a bit of code on a workbook_open() event. The small bit of code refreshes external data links, then loops through each chart and saves them out to a network drive, then saves the workbook as a different name. This is to provide a production copy that updates automatically and a "read-only" copy for people who want to simply view the updated copy. The problem is that the code hangs on the SaveAs line (see below), but the error gives reference to 'chart dimensions'. The network path is good, available, and the user has right to save there. After the debug, I can manually save it, just not sure why it hangs there as I use this line in several other workbooks.
Here's the code.
Private Sub Workbook_Open()
Dim cht As ChartObject
If ThisWorkbook.Name = ("DigitalSignage.xls") Then
Application.DisplayAlerts = False
'ThisWorkbook.RefreshAll
ActiveWorkbook.RefreshAll
ActiveWorkbook.Worksheets("GRAPHS").Activate
For Each cht In ActiveSheet.ChartObjects
cht.Activate
ActiveChart.Export "\\pltaub2\prod$\Aub\Auto_Reports\DigitalSignage\Display\Charts\" & cht.Name & ".png"
Debug.Print cht.Name
Next cht
ActiveWorkbook.SaveAs "\\pltaub2\prod$\Aub\Auto_Reports\DigSign.xlsm", FileFormat:=52
Application.Quit
Else
''
End If
End Sub
The error is below.
Run-time error '1004':
The specified dimension is not valid for the current chart type.
http://i.imgur.com/hBUrI.png
The funny thing is that I'm not specifying any dimensions for any chart. Also, the Debug.Print lists all of my charts, so it seems to be completing the For Next Loop.
Any help or insight appreciated.
Thanks in advance,
sirluke34
Bookmarks