I am completely flummoxed. I managed to put together a piece of code to extract various bits of data from an Excel workbook and paste them into a Word document. Part of this process extracts a chart as a .png file. This was working seamlessly two weeks ago, but today, when I come to run the code, it is failing at this line:
ChartObj.Chart.Export _
Filename:=wbBook.Path & "\" & stChartName, _
Filtername:="PNG"
Absolutely NOTHING has been changed in the code, and NOTHING has been moved on my PC. I really don't know where to start looking for the reason why this no longer wants to work. Anyone any ideas?
Relevant bits in the code that precede this section are:
Const stChartName As String = "Chart2.png"
Dim ChartObj As ChartObject
Set ChartObj = wsSheet.ChartObjects("Chart 2")

EDIT: The yellow arrow is pointing at this section of the code:
Changing this to GIF makes no difference.
I am getting a tooltip appearing at the point at which the code is highlighted in yellow saying "ActiveWorkbook = empty" - is this significant?
Bookmarks