How to figure out which axes are active on a graph

Hi all,

I am writing a macro to quickly modify a graph aesthetics in a single step using a prompt menu asking the type of graph, desired width of window etc. I want to include the titles of the axes (left, right, top, left) in the prompt.

My issue is that if the graph only has two active axes, the macro does not work because I am trying to label an axis which is not active. ("Expected name of active axis" error)

Is there a way to figure out which axes are active on a graph? From there, I can figure out how to write what I want.