View Single Post
  #3   Report Post  
jintao
 
Posts: n/a
Default


:( Here is my code to draw a diagonal line across the plotarea of the
chart, it does work but the Line does not align with the plotarea
exactly. Quite annoying


Sub DrawDiag()
With Worksheets(1)

'Get Chart Size
ChartSizeX = .ChartObjects(1).Chart.PlotArea.InsideWidth
ChartSizeY = .ChartObjects(1).Chart.PlotArea.InsideHeight

'Get Chart Positiion
ChartOffsetX = .ChartObjects(1).Left
ChartOffsetY = .ChartObjects(1).Top
PlotAreaOffsetX = .ChartObjects(1).Chart.PlotArea.InsideLeft
PlotAreaOffsetY = .ChartObjects(1).Chart.PlotArea.InsideTop

ChartPosX = ChartOffsetX + PlotAreaOffsetX
ChartPosY = ChartOffsetY + PlotAreaOffsetY

ChartEndX = ChartSizeX + ChartPosX
ChartEndY = ChartSizeY + ChartPosY

With .Shapes.AddLine(ChartPosX, ChartPosY, ChartEndX,
ChartEndY).Line
.Parent.Name = "line"
End With

End With
End Sub


--
jintao
------------------------------------------------------------------------
jintao's Profile: http://www.excelforum.com/member.php...o&userid=25395
View this thread: http://www.excelforum.com/showthread...hreadid=388667