resizing and moving chart elements

T

Tim

Hi All,

I am programatically creating a report which includes a number of
graphs. Depending on the report the position and size of elements
within the charts( ie the plot area, title and legend) may change. My
problem is that if I turn screen updating off to speed up the code the
charts do not update. I have searched the newsgroups and have tried
calling the sub that resizes /moves the chart elements multiple times
as has been suggested(Which didn't work). I have also tried running the
sub after screen updating has been turned back on and this works but
only for the charts visible on the screen. If I run the sub manually
after the report has been written it works but I do not want to do this
as the final user may not be bothered clicking two buttons to get the
report. My final solution has been change the code to zoom out and
scroll page by page through the report updating the visible graphs
unitll all have been updated( which works but doesn't look very flash).
My question: has anyone else experienced this sort of thing before and
been able to solve it without turning screenupdating back on first?

Apoligies for the long rambling post

Any help much appreciated

regards

Tim
 
J

Jon Peltier

Tim -

This used to be an issue in Excel 97 (I had a routine that scrolled to the
chart, then scrolled back), but I have not had problems since I upgraded to
2000.

- Jon
 
T

Tim

Thanks Jon

I am using Excel 2003 which I thought would have got rid of bugs from
the 97 version, strange
 
J

Jon Peltier

When I reread your post, I realize there are still issues with charts and
VBA. It is hard to reliably position the plot area of a chart within the
chart area. Usually it works fine, but sometimes there is a magic number of
points that the .top or .left of the plotarea cannot attain, and you need to
use a bunch of iteration to get as close as you can. Positioning the inner
plot area can only be done indirectly by positioning the (outer) plot area
while taking into account the margins required for labels and such.
Supposedly using the old XLM macro commands are more reliable, but I never
really learned these.

Apparently the Excel designers turn off not just the screen display but
calculations of where screen elements should display, when screen updating
is False; especially on older computers, complicated charts can be very slow
to redraw. You might avoid the need for screen updating if you sprinkle
DoEvents statements within the offending code. It makes Excel go through the
screen calculations without actually updating the screen. DoEvents doesn't
help with the precision problem I mentioned above, but it helps with getting
a freshly redrawn chart.

- Jon
 

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