Page 1 of 1

How to activate a specific sheet in an Excel file?

Posted: 21 Jun 2021, 20:00
by Muhammadi
Hi,
Does anyone know how to activate a specific sheet of an Excel file in PMC?

This script activates the Excel file:
WinActivate, File's name - Excel ahk_class XLMAIN

I need a similar thing but for a specific sheet in the excel file.

Thanks,
Muhammadi

Re: How to activate a specific sheet in an Excel file?

Posted: 27 Jun 2021, 12:40
by aifritz
I'm not working with PMC, but there are many examples already in the forum.
With ahk and a bit knowledge of VBA you nearly could automate everything.

here a simple example...

Code: Select all

xl:=ComObjActive("Excel.Application")
xl.Sheets(2).Activate ;activates sheet 2 of the current spreadsheet