Introduction...How we got here
- Select Sheet1!B2, then click on the Freeze of the View menu to Freeze Panes
- Do the same for Sheet2 and Sheet3
- Click on the New Window icon and a new window is created, with the active worksheet's FreezePanes set like the original.
- However, if you view the other sheets of the same window you will not see frozen panes.
What is needed
|Excel's View Menu|
|New Window created. Both Windows side-by-side|
- The For...Next structure could be used against the Windows collection, accessing the new Window and the original one.
- As before, Workbook event Subs, in this case WindowActivate and WindowDeactivate, could be leveraged.
- There still needed to be communication between the different event-triggered Subs
- A data structure (complex data type) would be useful as an array to gather the originating Window's FreezePane settings and applying them to the new Window's SheetViews
- The data structure needed to be in a normal Module, not in the Workbook's object module.
- Setting the FreezePane parameters was done when the Sheet was active
- Activating the Sheet as Workbook.Sheets() did not provide the proper access to setting the FreezePane parameters.
- To get the needed access to the FreezePane parameters, it was necessary to activate the Sheet as a member of the Window.ActiveSheets collection.
- When clicking on the New Window icon of the View menu, the subsequent events are, in order
- The New Window is created
- The originating Window is deactivated
- The new Window is activated
- Create an array of the Freeze Pane settings of the original Window, called during the DeactiveWindow Sub
- Apply the settings to the SheetView.Sheets of the new window, called during the WindowActivate Sub.