J
John
I have code that creates as separate sheets (not on a worksheet). The charts
are included in paper reports and the users need to be able to hold different
chart up to the light to see how various cases compare or various results
from a similar case. The plots have the same X-Axis configuration (except
where it crosses the Y-Axis). However, the Y-Axis parameters are different
(scales, number format, etc.).
There may be up to 50 charts per case.
Therefore, the INSIDE plot area of the charts has to be at exactly the same
left, top coordinate and have exactly the same width and height. The
following codes gets it close. Why doesn't it make it exact?
Private Sub ResizePlot(oChart As Chart)
Dim PALt As Single, PATp As Single, PAWd As Single, PAHt As Single
Dim PAILt As Single, PAITp As Single, PAIWd As Single, PAIHt As Single
Dim PADLt As Single, PADTp As Single, PADWd As Single, PADHt As Single
With oChart
With .PlotArea
PALt = .Left
PATp = .Top
PAWd = .Width
PAHt = .Height
PAILt = .InsideLeft
PAITp = .InsideTop
PAIWd = .InsideWidth
PAIHt = .InsideHeight
PADLt = Application.InchesToPoints(1.25)
PADTp = Application.InchesToPoints(0.9)
PADWd = Application.InchesToPoints(7#)
PADHt = Application.InchesToPoints(6#)
.Left = PADLt - (PAWd - PAIWd)
.Top = PADTp - (PAITp - PATp)
.Width = PADWd + (PAWd - PAIWd)
.Height = PADHt + (PAHt - PAIHt)
End With
End With
End Sub
Also, I have noticed that the inside dimensions change when I add shapes to
the chart sheet. The Charts have to be landscape. However, there has to be
a header and footer on the right and left sides, rotated so that the page
appears in portrait. So I add AddTextEffect and rotate 90. When I do this
the plotarea dimensions change without a change to the chartarea.
I have all the AutoScaleFont values that I could find and use (ChartArea,
ChartTitle, AxisTitle (both), Legend, TickLabels) set to false and I do
nothing after running the above routine. However, plots with the
AddTextEffect have different dimensions that plots without AddTextEffect.
Windows XP, Excel 2002 SP-2
Thanks,
John
are included in paper reports and the users need to be able to hold different
chart up to the light to see how various cases compare or various results
from a similar case. The plots have the same X-Axis configuration (except
where it crosses the Y-Axis). However, the Y-Axis parameters are different
(scales, number format, etc.).
There may be up to 50 charts per case.
Therefore, the INSIDE plot area of the charts has to be at exactly the same
left, top coordinate and have exactly the same width and height. The
following codes gets it close. Why doesn't it make it exact?
Private Sub ResizePlot(oChart As Chart)
Dim PALt As Single, PATp As Single, PAWd As Single, PAHt As Single
Dim PAILt As Single, PAITp As Single, PAIWd As Single, PAIHt As Single
Dim PADLt As Single, PADTp As Single, PADWd As Single, PADHt As Single
With oChart
With .PlotArea
PALt = .Left
PATp = .Top
PAWd = .Width
PAHt = .Height
PAILt = .InsideLeft
PAITp = .InsideTop
PAIWd = .InsideWidth
PAIHt = .InsideHeight
PADLt = Application.InchesToPoints(1.25)
PADTp = Application.InchesToPoints(0.9)
PADWd = Application.InchesToPoints(7#)
PADHt = Application.InchesToPoints(6#)
.Left = PADLt - (PAWd - PAIWd)
.Top = PADTp - (PAITp - PATp)
.Width = PADWd + (PAWd - PAIWd)
.Height = PADHt + (PAHt - PAIHt)
End With
End With
End Sub
Also, I have noticed that the inside dimensions change when I add shapes to
the chart sheet. The Charts have to be landscape. However, there has to be
a header and footer on the right and left sides, rotated so that the page
appears in portrait. So I add AddTextEffect and rotate 90. When I do this
the plotarea dimensions change without a change to the chartarea.
I have all the AutoScaleFont values that I could find and use (ChartArea,
ChartTitle, AxisTitle (both), Legend, TickLabels) set to false and I do
nothing after running the above routine. However, plots with the
AddTextEffect have different dimensions that plots without AddTextEffect.
Windows XP, Excel 2002 SP-2
Thanks,
John