Alternative text of Excel chart

To get the alternative text of an Excel chart, you need to look at the alternative text property of a shape.

I know I can use a workaround and access it in VBA but I have not been able to read the property in vanilla AS. Am I missing something?

To test, create a chart in Excel, right click on chart and select Format Chart Area…


tell application "Microsoft Excel"
	set myShapes to shapes of active sheet
	--{shape connector 1 of active sheet of application "Microsoft Excel", shape connector 2 of active sheet of application "Microsoft Excel"}
	
	set shapeProperties to properties of (item 1 of myShapes)
	(*
		{class:shape connector, text frame:text frame of shape connector 1 of active sheet of application "Microsoft Excel", shape text frame:shape text frame of shape connector 1 of active sheet of application "Microsoft Excel", auto shape type:autoshape shape type unset, connection site count:4, connector:false, connector format:connector format of shape connector 1 of active sheet of application "Microsoft Excel", connector type:missing value, fill format:fill format of shape connector 1 of active sheet of application "Microsoft Excel", height:216.0, horizontal flip:false, left position:337.0, line format:line format of shape connector 1 of active sheet of application "Microsoft Excel", lock aspect ratio:false, name:"Chart 1", rotation:0.0, shadow format:shadow format of shape connector 1 of active sheet of application "Microsoft Excel", word art format:missing value, threeD format:threeD format of shape connector 1 of active sheet of application "Microsoft Excel", top:48.5, shape type:shape type chart, vertical flip:false, visible:true, width:324.0, z order position:1, hyperlink:missing value, black white mode:black and white mode automatic, shape on action:"", locked:true, top left cell:top left cell of shape connector 1 of active sheet of application "Microsoft Excel", bottom right cell:bottom right cell of shape connector 1 of active sheet of application "Microsoft Excel", placement:placement move and size, child:false, has chart:true, chart:chart of shape connector 1 of active sheet of application "Microsoft Excel", shape style:shape not a preset, background style:background not a preset, soft edge format:soft edge format of shape connector 1 of active sheet of application "Microsoft Excel", glow format:glow format of shape connector 1 of active sheet of application "Microsoft Excel", reflection format:reflection format of shape connector 1 of active sheet of application "Microsoft Excel", alternative text:"myText", character range:missing value}
	*)
	
	set altText to alternative text of (item 1 of myShapes)
	-- missing value
	
end tell

Hi there,

If I execute the following I can see the ‘alternative text’ value of the chart:


tell application "Microsoft Excel"
	activate
	set x to every shape of (active sheet of active workbook)
	set y to item 1 of x
end tell

When I add the following I get a ‘missing value’:


set a to alternative text of z

And, when I try an set a new value I get an error too.

Just the same.

Do you mean that you can see it in a program that lists the properties (Script Debugger) or that you can set the y variable to the value of the alternative text?


tell application "Microsoft Excel"
	activate
	set x to every shape of (active sheet of active workbook)
	-- {shape connector 1 of active sheet of active workbook of application "Microsoft Excel", shape connector 2 of active sheet of active workbook of application "Microsoft Excel"}
	
	set y to item 1 of x
	-- shape connector 1 of active sheet of active workbook of application "Microsoft Excel"
	
end tell

Only had a quick look at this originally.

Yes, I can see the value in Script Debugger.
When I try and do anything further with it I get a ‘missing value’.

EDIT:

I’ve tried this:


tell application "Microsoft Excel"
	
	set x to every shape of (active sheet of active workbook)
	set y to item 1 of x
	
	set y1 to properties of y as list
	
	set y2 to name of y
	set y3 to top of y
	set y4 to width of y
	set y5 to auto shape type of y
	
	set y6 to alternative text of y

end tell

y6 returns a ‘missing value’ in Script Debugger and Applescript Editor.
Could the property be broken in some way?

I can see the correct value returned in the best tab of the results window after…

set shapeProperties to properties of (item 1 of myShapes)

However, when I try to access it programmatically, it returns a missing value.

Yeah, same for me.

I’ve tried a few variations on a theme to achieve it, but as yet I’ve not managed. :confused: