You can achieve the functionality you described by adding VBA code to your macro-enabled workbook. Specifically, you can use the `Workbook_Open` and `Workbook_BeforeClose` events to freeze the top row when the workbook is opened and unfreeze it when the workbook is closed.
Here's a sample VBA code that you can add to your workbook's VBA project:
VBA Code:
Private Sub Workbook_Open()
' This code will run when the workbook is opened
ActiveWindow.SplitRow = 1
ActiveWindow.FreezePanes = True
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
' This code will run before the workbook is closed
ActiveWindow.FreezePanes = False
End Sub