Macro Sheets Only
Equivalent to choosing the Titles command from the Insert menu available when a chart is displayed in the active window. Attaches text to certain parts of the selected chart. Use ATTACH.TEXT to attach text as a title or as a label for an axis or data point.
Syntax
ATTACH.TEXT(attach_to_num, series_num, point_num)
ATTACH.TEXT?(attach_to_num, series_num, point_num)
Attach_to_num specifies which item on a chart to attach text to. Attach_to_num is different for 2-D and 3-D charts. Attach_to_num values for 2-D charts are shown in the following table.
Attach_to_num Attaches text to
1 Chart title
2 Value (y) axis
3 Category (x) axis
4 Series and data point
5 Secondary value (y) axis
6 Secondary category (x) axis
Attach_to_num values for 3-D charts are shown in the following table.
Attach_to_num Attaches text to
1 Chart title
2 Value (z) axis
3 Series (y) axis
4 Category (x) axis
5 Series and data point
Series_num specifies the series number if attach_to_num specifies a series or data point. If attach_to_num specifies a series or data point and series_num is omitted, the macro is interrupted.
Point_num specifies the number of the data point, but only if you specify a series number. Point_num is required if series_num is specified, unless the chart is an area chart.
Remarks
When you record adding an axis title or a chart title, Microsoft Excel records both an ATTACH.TEXT function to attach the text and a FONT.PROPERTIES function to make the text bold.
Example
The following macro functions attach the text "Quarterly Sales" to the X (category) axis of the selected chart:
ATTACH.TEXT(3) FORMULA("Quarterly Sales")
Related Functions
DATA.LABEL Assigns text labels to point on a chart
FORMULA Enters values into a cell or range or onto a chart
List of Command-Equivalent Functions