Get Active Sheet Name

Hello,

please, would it be possible to get the active / current sheet name? I certainly don’t want all the sheet names, nor can I make a list of them, as they can change. But for Write Cell I need to insert sheet name and that changes throughout the whole process, so all I need is the name of the one, which I currently see.

Please help.

Thank you

1 Like

You might investiate using an XLS macros to get the sheet name (macro, sheet name)

Or you might go the image-automation route: Find the images that correspond to a selected sheet, then scrape between them

Let me suggest this idea. Choose Rename Sheet then copy the text.
So you could do this with a TypeInto key combination

For example,
TypeInto
“[k(alt)]hor[d(ctrl)]c[u(ctrl)]”
Get Text from Clipboard

Or I suppose if the sheets were in a consistent order or a naming convention that you can sort, then you could use the Workbook variable with wb.GetSheets and sort or filter the array down to the sheet that would be the most recent. (which is the method I would normally use)

Thanks.

2 Likes

Macro may work but we wanted to avoid macros. Excel is very complex and it’s already complicated. Image-automation is not an option. We want the user to be able to add new sheets without the need to reprogram the robot. So if there was an action or expression which would give me a current sheet name, it would be a perfect solution, but I guess that’s too much to ask haha.

Thanks anyway :slight_smile:

Hello!

Here’s some topics with the same question that you’re asking for:

Hope It Helps!

Regards,

To get the current sheet name all you have to do is :

Get Text on the name bar

Selector :

<wnd app='excel.exe' cls='XLMAIN' title='Microsoft Excel*' />
<wnd cls='EXCEL*' title='*' />
<ctrl name='*' role='client' />
<ctrl name='Barre de navigation de classeur' role='client' />
<ctrl name='Onglets de classeur' role='page tab list' />

Sorry its in French, but I’m sure you get the idea