Hi All,
I am developing a program using userforms to display various charts. I use the chart.export property to save and load chart pictures on userform images.
The program was developed under Windows XP using Excel 2007. I had absolutely no issue under this environment.
I bought a new computer lately running on Windows 7 with Excel 2010. Under this new environment the chart.export property fails randomly creating files with correct extensions but with no data (0 kb). Sometimes the export works properly and images are displayed appropriately, sometimes the export fails and I get the Run Time Error 481 - Invalid Picture.
I have 6 userfoms each displaying 2 to 3 charts. Only 2 of these 6 userforms are affected by the export failure. All others work appropriately.
Here is the code I use to export charts as pictures. This is exactly the same kind of code used for all userforms:
Code:
Set CurrentChart = Sheets("ANA_TECHNIQUE").ChartObjects("Chart 1").Chart
CurrentChart.ShowWindow = True
ANATECHCHART1 = ThisWorkbook.Path & "\TEMP\ANATECHCHART1.gif"
CurrentChart.Export Filename:=ANATECHCHART1, FilterName:="GIF"
AnaTechnique.Image1.Picture = LoadPicture(ANATECHCHART1)</pre>
I spent hours trying to understand this unstable behavior (registry, chart reference, etc) but got no luck.
Any help would be greatly appreciated. Thanks in advance!!
I am developing a program using userforms to display various charts. I use the chart.export property to save and load chart pictures on userform images.
The program was developed under Windows XP using Excel 2007. I had absolutely no issue under this environment.
I bought a new computer lately running on Windows 7 with Excel 2010. Under this new environment the chart.export property fails randomly creating files with correct extensions but with no data (0 kb). Sometimes the export works properly and images are displayed appropriately, sometimes the export fails and I get the Run Time Error 481 - Invalid Picture.
I have 6 userfoms each displaying 2 to 3 charts. Only 2 of these 6 userforms are affected by the export failure. All others work appropriately.
Here is the code I use to export charts as pictures. This is exactly the same kind of code used for all userforms:
Code:
Set CurrentChart = Sheets("ANA_TECHNIQUE").ChartObjects("Chart 1").Chart
CurrentChart.ShowWindow = True
ANATECHCHART1 = ThisWorkbook.Path & "\TEMP\ANATECHCHART1.gif"
CurrentChart.Export Filename:=ANATECHCHART1, FilterName:="GIF"
AnaTechnique.Image1.Picture = LoadPicture(ANATECHCHART1)</pre>
I spent hours trying to understand this unstable behavior (registry, chart reference, etc) but got no luck.
Any help would be greatly appreciated. Thanks in advance!!