Changing VBA to Office Script - Keep One Sheet Tab Visible (Excel Onlin)

Kendra Haug 1 Reputation point
2022-01-20T18:23:52.833+00:00

I had this basic code set up on my Excel (Desktop App):

Private Sub Workbook_SheetActivate(ByVal Sh As Object)
'UpdatebyExtendoffice2018027
Dim xSheet As Worksheet
Application.EnableEvents = False
Set xSheet = Sheets("MainSheet")
If Sh.Name <> xSheet.Name Then
Sh.Move , xSheet
xSheet.Activate
Sh.Activate
End If
Application.EnableEvents = True
End Sub

I know there is the "3 line" in Excel online that shows all the sheets; but this is quite a big sheet so a lot of scrolling is already involved. I would like to keep on sheet's tab always visible.

Is there an Office Script version of this?

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
2,168 questions
No comments
{count} votes

1 answer

Sort by: Most helpful
  1. @kinuasa 331 Reputation points
    2022-01-21T07:56:16.97+00:00

    Unfortunately, Office Scripts do not support workbook-level events, so they cannot do the same as VBA.

    1. Differences between Office Scripts and Office Add-ins
      https://learn.microsoft.com/en-us/office/dev/scripts/resources/add-ins-differences?WT.mc_id=M365-MVP-4029057
    2. Differences between Office Scripts and VBA macros
      https://learn.microsoft.com/en-us/office/dev/scripts/resources/vba-differences?WT.mc_id=M365-MVP-4029057