ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Charts and Charting in Excel (https://www.excelbanter.com/charts-charting-excel/)
-   -   Problem to modify the size of PlotArea (https://www.excelbanter.com/charts-charting-excel/84887-problem-modify-size-plotarea.html)

Xavier

Problem to modify the size of PlotArea
 
Hello,

I am trying to modify a chart so that it prints in a 20cm x 17,5cm frame. I
do understand that this is governed by the plotarea.insideheight and
plotarea.insidewidth properties. I also do understant that these properties
are read-only. So far my code is the following:

With ActiveChart
.SizeWithWindow = False
.PageSetup.ChartSize = xlScreenSize
.PlotArea.Width = 567
.PlotArea.Height = 496
Do While .PlotArea.InsideWidth < 567
.PlotArea.Width = .PlotArea.Width + 1
Loop

Do While .PlotArea.InsideHeight < 496
.PlotArea.Height = .PlotArea.Height + 1
Loop

End With


The problem I am facing is the following: the first do...loop works fine and
if I print the result, I do get exactly 20cm. However, the second do...loop
loops indefinitely, in debugging mode, I see that the initial value of
..PlotArea is 451 (and not 496) and during the loop, it never gets increased
???

Does anyone know what am I doing wrong ?

Thanks,

Xavier




Xavier

Problem to modify the size of PlotArea
 
Problem solved:

The margins defined in my page setup were limiting the hight that could be
used for the chart. Reducing the margins solved the issue.

Xavier

"Xavier" wrote in message
...
Hello,

I am trying to modify a chart so that it prints in a 20cm x 17,5cm frame.
I do understand that this is governed by the plotarea.insideheight and
plotarea.insidewidth properties. I also do understant that these
properties are read-only. So far my code is the following:

With ActiveChart
.SizeWithWindow = False
.PageSetup.ChartSize = xlScreenSize
.PlotArea.Width = 567
.PlotArea.Height = 496
Do While .PlotArea.InsideWidth < 567
.PlotArea.Width = .PlotArea.Width + 1
Loop

Do While .PlotArea.InsideHeight < 496
.PlotArea.Height = .PlotArea.Height + 1
Loop

End With


The problem I am facing is the following: the first do...loop works fine
and if I print the result, I do get exactly 20cm. However, the second
do...loop loops indefinitely, in debugging mode, I see that the initial
value of .PlotArea is 451 (and not 496) and during the loop, it never gets
increased ???

Does anyone know what am I doing wrong ?

Thanks,

Xavier







All times are GMT +1. The time now is 01:34 AM.

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