Chart.Export images are shrinking as I export more images

J

Jared

Hi, I have a chart object in an excel sheet, that I have programmatically
exporting the chart to JPG file. I have a button the the page, that I have
tied to VB MOD in the worksheet that does this:

Dim chartObject As chartObject
Set chartObject = Sheet3.ChartObjects(2)
chartObject.Chart.Export GetFilePath(), "jpg", False
Set chartObject = Nothing

The export works fine and creates new images every time the user clicks on
the button, but the problem is user is exporting the chart many times the
chart image file starts to shrink in size? I am using Excel 2003. Has
anyone out there had this problem, and if so what did they do to correct the
issue?

Thanks
 
J

Jon Peltier

1. In general, jpg is the wrong format to use for exporting charts. Use gif
or png instead.

2. I ran your code several times and the output files were all identical.
What else is happening to the chart in between export cycles?

- Jon
 
J

Jared

I will try your option 1., that sounds promising.

Option 2. Between clicks I am programmatically coping cells from column A to
column B. These values are NOT changing the trace on the chart. When the
chart gets smaller, the actual dimensions of the picture aren't smaller, but
if you look at the pictures side by side, you will notice the grid is getting
smaller on the screen.

I also have noticed that is isn't a problem in XCEL 2007 (Compatibility
Mode), only in 2003 and 2000? Any ideas?

Thanks in advance for all you help, I really appreciate it!
 
J

Jon Peltier

I will try your option 1., that sounds promising.

I don't think it will have any effect on the shrinking, but in general the
images will be sharper.
Option 2. Between clicks I am programmatically coping cells from column A
to
column B. These values are NOT changing the trace on the chart. When the
chart gets smaller, the actual dimensions of the picture aren't smaller,
but
if you look at the pictures side by side, you will notice the grid is
getting
smaller on the screen.

Are you copying cells with formatting, or just values?

By 'grid', do you mean the plot area rectangle defined by the axes?

If the values are increasing, then the axis labels might be growing by a
character at a time. This forces the axis into the chart to make room for
longer labels, and therefore, shrinks the plot area.
I also have noticed that is isn't a problem in XCEL 2007 (Compatibility
Mode), only in 2003 and 2000? Any ideas?

Hmm, I'd expect it to be a problem in 2007 and not in the others. But that's
because of other interesting functionality I've encountered in 2007. If it's
the changing size of axis labels, there may be differences in how Excel 2007
handles the text.

- Jon
 
G

Greg G

Jare, did you ever resolve the original problem of the graphs shrinking? For me, it happens after printing or a print preview. The graph "content" shrinks but the graph box remains the same.

Thanks.
Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top