I need to find out if a sheet is hidden using an Excel 4 macro function / Excel SDK, preferably getting XlSheetVisibility value (i.e. xlSheetHidden
, xlSheetVeryHidden
, xlSheetVisible
).
I would expect this kind of query to be possible by GET.DOCUMENT()
but that doesn't seem to be the case.
I also looked into GET.WORKBOOK()
and GET.WORKSPACE()
to no avail.
Is there a way to do this thru a macro function without resorting to VBA?
GET.WORKBOOK(38)
returns the name of the active sheet.
Hidden sheets can't be activated.
So, first call WORKBOOK.SELECT("sheetname", "sheetname")
to select the desired sheet and attempt to make it active. If that sheet is hidden, it will fail and the active sheet won't change. Then call GET_WORKBOOK(38)
to get the name of the current active sheet. If it's "sheetname" then it's not hidden.
Unfortunately this doesn't distinguish between hidden and veryHidden.