+ Reply to Thread
Results 1 to 2 of 2

Chart.export creates corrupt files randomly

  1. #1
    Registered User
    Join Date
    08-27-2010
    Location
    London, England
    MS-Off Ver
    Excel 2010
    Posts
    1

    Chart.export creates corrupt files randomly

    Hi All,

    I am developing a program using userforms to display various charts. I use the chart.export property to load charts 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:

    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)


    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!!

  2. #2
    Registered User
    Join Date
    05-26-2014
    Posts
    1

    Re: Chart.export creates corrupt files randomly

    I have slightly modified the code

    Set CurrentChart = Sheets("ANA_TECHNIQUE").ChartObjects(1).Chart

    Hoping that it will work fine!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1