I am using API calls but the errors do not derive from the module that contains them. It seems that (at least some of) the errors are stemming from the following subroutine:
Essentially (all the fiddly details aside) the routine takes an image control in a userform and loads a picture to it which is saved in a worksheet, embedded in a chart frame; the chart frame is first re-sized to match the dimensions of the control (this had to be done to accommodate different local resolution settings). The image in the worksheet is then exported to a static image file ("~TempImg.xxx"), which is loaded to the control and then the temporary file is deleted. All pretty standard and straight forward and not a problem in Excel 2010 and 2013 but it 2007 it falls down.
It seems to fall down specifically when it is being called multiple times in quick succession - the same routine is used without a problem to load images at other points in the code. My suspicion is that the code is running faster than the excel 2007 system can export the image file, load it and delete it. I have tried using a sleep procedure to add a pause in the code to allow the system to "catch up", I have tried adding DoEvents (which, incidentally, I have never found to make a difference in any scenario) but to no avail.
The most common errors are 70 (permission denied) and 75 (path/file access error), which I think lends weight to my suspicion. Any thoughts?
Bookmarks