Changing chart title changes position of chart

G

Guest

Hello,

I've written some code to programmatically change the chart title and chart
title font size based on user interaction.

Problem is that each time the title undergoes a smaller font size change,
the chart actually changes position within the chart area by moving up.

Also any labels i've placed in the chart area also changes position and move
up as well.

Anyone have any ideas why and how to stop this?

Thank for helping!
 
M

Markus Scheible

Good Morning Bing,
Problem is that each time the title undergoes a smaller font size change,
the chart actually changes position within the chart area by moving up.

Also any labels i've placed in the chart area also changes position and move
up as well.

Anyone have any ideas why and how to stop this?

well, afaik this is because Excel automatically arranges
all elements within a chart so that every element has the
max size. So if e.g. the chart title becomes smaller,
excel makes the chartarea larger...

I think you could stop this by using the

AutoScaleFont Property

for each element within the chart... e.g.

Selection.AutoScaleFont = False

Best

Markus
 
J

Jon Peltier

Also, once you explicitly set the size/position of an object, Excel doesn't try to
autofit it within the chart. So:

With ActiveChart.PlotArea
' position and size parameters are in points
' choose parameters that suit your situation
'
' shrink plot area first so you can move unconstrained
.Width = 50
.Height = 50
' position and resize plot area
.Left = 10
.Top = 24
.Width = 250
.Height = 175
End With

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

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