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

Posted on 2010-06-11
Medium Priority
Last Modified: 2012-06-22
Anyone know what comment to issue in Powershell to tell MS Excel to create a Freeze Pane row?

Question by:gerhardub
  • 2

Accepted Solution

rwskas earned 2000 total points
ID: 32973795
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


Expert Comment

ID: 32974549
Glad I could help!

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Measuring Server's processing rate with a simple powershell command. The differences in processing rate also was recorded in different use-cases, when a server in free and busy states.
The PowerShell Core 6.0 of .NET release is just the beginning. The upcoming PowerShell Core 6.1 would have artificial intelligence and internet of things capabilities. So many things to look forward to in the upcoming release.
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question