Setting an AX attribute?

Hi, All –

The AXPress action upon an AXDisclosureTriangle turns its AXValue from 1 to 0, or 0 to 1, with the effect of expanding (as 1) or collapsing (as 0) the associated outline’s rows. But it’s just a toggle. I want to give it some smarts so I expand or collapse specific rows, and not merely toggle them. My code looks like this, working with MS Excel’s Visual Basic Editor.


set MS_OfficeAppsPath to (path to "apps" as string)
set MS_OfficeAppsPath to MS_OfficeAppsPath & "Microsoft Office 2011:"
set MS_ExcelApp to MS_OfficeAppsPath & "Microsoft Excel.app"
tell application "System Events"
	tell application MS_ExcelApp to activate
	tell application process "Excel" --VBE already open
	set frontmost to true --Necessary to see "Project"
		tell window "Project" --(windows whose name is "Project")
			tell first scroll area
				tell outline 1
					tell row 1
						tell group 1
							try
								tell UI element 1 to set its AXValue to 0 as string
								--UI element 1 is an AXDisclosureTriangle
							end try
						end tell
					end tell
				end tell
			end tell
		end tell
	end tell
end tell

I’ve also tried setting the AXValue to 0 as number, to open, closed, and collapsed. None of those appear to be the magic words.

Alternatively, is there a way to get at the AXValue beforehand so I can suss out the ones to toggle?

As always, all help appreciated. Thanks.

…Mick