PlotArea.Left Question

R

Richard Weatherly

I want to place a text box at a specific location in the plot area of a chart
using VBA. ActiveChart.PlotArea.Left and ActiveChart.PlotArea.Width will
return the left edge and width of the plot area, but the .Left function
includes the "Y" axis scale as the left most point. In other words, the
..Left point is the left edge of the scale values and not the left edge of the
plot area.

Any suggestions?
 
P

Peter T

Select a chart, ensure it has a left value axis

Sub test2()
Dim lt as single, tp as single

With ActiveChart.Axes(xlValue, xlPrimary)
lt = .Left
tp = .Top
End With

ActiveChart.Shapes.AddShape 1, lt, tp, 30, 20

End Sub

should add a rectangle to the top-left corner of the apparent shaded plot
area,

Regards,
Peter T
 
J

Jon Peltier

Without having to assume anything about axes, use:

With ActiveChart.PlotArea
lt = .InsideLeft
tp = .InsideTop
wd = .InsideWidth
ht = .InsideHeight
End With


- 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

Similar Threads


Top