ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Chart.Export images are shrinking as I export more images (https://www.excelbanter.com/charts-charting-excel/174636-chart-export-images-shrinking-i-export-more-images.html)

Jared

Chart.Export images are shrinking as I export more images
 
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


Jon Peltier

Chart.Export images are shrinking as I export more images
 
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
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Jared" wrote in message
...
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




Jared

Chart.Export images are shrinking as I export more images
 
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!

"Jon Peltier" wrote:

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
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"Jared" wrote in message
...
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





Jon Peltier

Chart.Export images are shrinking as I export more images
 

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
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______







All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com