Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Exporting graphs causes unwanted resizement!

I have written a macro that exports 44 graphs to a certain directory
under unique names. The problem hereby is that every time i use this
macro, the graphs turn smaller and smaller. When the macro is used
about 5 times, the graphs (piecharts) are about 40% of its original
size i created them.

The resizing affects not the outer graph box (title, graph, labels
etc.), but only the inner graph (only piechart display) box.


VBA code used.
Sub ExportAllCharts()

Sheets("Graphs").Select
ActiveSheet.ChartObjects("Grafiek 2").Activate
ActiveChart.ChartArea.Select
ActiveChart.Export Filename:="W:\GEBOUW\DATAHVD\Beheer\Beheer Energie
\-- Website updating--\Energy
section\All Graphs\2006 PieChart Electricity DAF Hi.jpg", _
FilterName:="jpeg"

ActiveSheet.ChartObjects("Grafiek 12").Activate
ActiveChart.ChartArea.Select
ActiveChart.Export Filename:="W:\GEBOUW\DATAHVD\Beheer\Beheer Energie
\-- Website updating--\Energy
section\All Graphs\2006 PieChart Gas DAF Hi.JPG", _
FilterName:="jpeg"

AND THE SAME FOR ALL OTHER 42 GRAPHS :)

Sheets("Macro blad").Select
Range("E19").Select
ActiveWorkbook.Save
End VBA code example

Does anyone have a solution?

(NOTE: i am a beginning VBA user)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Exporting graphs causes unwanted resizement!

I don't know about the resizing. Sometimes it may be due to selecting and
deselecting the chart. This code prevents the gratuitous selection of
objects, which will make the code run more quickly and make the screen
remain static without flashing, and it may help with the resizing:

Sheets("Graphs").ChartObjects("Grafiek 2").Chart.Export _
Filename:=sLongString, FilterName:="jpeg"

Also, charts usually look better exported using the GIF or PNG filters. JPEG
was designed for photographic images with gradual color transitions, not for
line art.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


wrote in message
oups.com...
I have written a macro that exports 44 graphs to a certain directory
under unique names. The problem hereby is that every time i use this
macro, the graphs turn smaller and smaller. When the macro is used
about 5 times, the graphs (piecharts) are about 40% of its original
size i created them.

The resizing affects not the outer graph box (title, graph, labels
etc.), but only the inner graph (only piechart display) box.


VBA code used.
Sub ExportAllCharts()

Sheets("Graphs").Select
ActiveSheet.ChartObjects("Grafiek 2").Activate
ActiveChart.ChartArea.Select
ActiveChart.Export Filename:="W:\GEBOUW\DATAHVD\Beheer\Beheer Energie
\-- Website updating--\Energy
section\All Graphs\2006 PieChart Electricity DAF Hi.jpg", _
FilterName:="jpeg"

ActiveSheet.ChartObjects("Grafiek 12").Activate
ActiveChart.ChartArea.Select
ActiveChart.Export Filename:="W:\GEBOUW\DATAHVD\Beheer\Beheer Energie
\-- Website updating--\Energy
section\All Graphs\2006 PieChart Gas DAF Hi.JPG", _
FilterName:="jpeg"

AND THE SAME FOR ALL OTHER 42 GRAPHS :)

Sheets("Macro blad").Select
Range("E19").Select
ActiveWorkbook.Save
End VBA code example

Does anyone have a solution?

(NOTE: i am a beginning VBA user)



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Exporting graphs to Word kippers Excel Discussion (Misc queries) 3 April 9th 09 01:34 PM
Exporting Excel Graphs Richard John Excel Programming 4 April 29th 06 09:29 PM
Unwanted £ signs when exporting data from access into excel Judy Excel Discussion (Misc queries) 2 January 17th 06 04:40 PM
Exporting EXCEL Graphs as .gif (image file) using VBA or VB haresh7263 Excel Programming 1 July 11th 05 02:39 AM
graphs showing unwanted zero values Zadig Galbaras Excel Discussion (Misc queries) 2 June 1st 05 10:34 PM


All times are GMT +1. The time now is 07:16 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"