We help IT Professionals succeed at work.

Powershell: How to set a "Freeze Pane" Row in Excel from Powershell

Anyone know what comment to issue in Powershell to tell MS Excel to create a Freeze Pane row?

GB
Comment
Watch Question

Commented:
The last 3 lines of this code is how you setup FreezePanes
$Excel = New-Object -Com Excel.Application
$Excel.visible = $True
$Excel = $Excel.Workbooks.Add()
$wSheet = $Excel.Worksheets.Item(1)
$wSheet.Cells.item(1,1) = "This is my header"
$wsheet.application.activewindow.splitcolumn = 0
$wsheet.application.activewindow.splitrow = 1
$wsheet.application.activewindow.freezepanes = $true

Open in new window

Commented:
Glad I could help!