Microsoft Office Tutorials and References
In Depth Information
DETERMINE THE HEIGHT AND WIDTH OF THE DATALABEL OBJECT
Background: The solution to this problem makes use of the fact that it is not
possible to move a data label (or, for that matter, any movable chart element,
such as a legend, a chart title, an axis title etc.) even partially off the chart
area. To verify this, select a single data label with two single clicks and try
dragging it off the chart through the bottom-right corner. You cannot drag it
beyond the point where the bottom-right corners of the data label and the
chart coincide.
Figure 86 illustrates the situation that prevails when the label is moved to the
bottom-right corner of the chart area. The origin (0,0) for the chart coordinates
is the top-left corner of the chart area.
Figure 86. h
e label has been moved to the bot om-right corner.
Using VBA, Wd =ChartArea.Width, Ht = ChartArea.Height
The values of x and y are obtained from the Top and Left properties of the
DataLabel object.
.
The height and width of the label can be calculated as:
h = Ht – y
w = Wd – x
Solution: Ensure that the chart in question is the active chart and use the
following code:
 
Search JabSto ::




Custom Search