Setting FreezePanes Property of the windows class -Excel VBA
<p>I have a huge application for importing and exporting which was written back in the version VBA 9.1 and <strong>migrating</strong> it to Excel 2013
I'm facing problem during the freezing of first row using this line.</p>

<pre><code>AddWorksheetWithDefaults.Parent.Windows(1).Activate
With AddWorksheetWithDefaults.Parent.Windows(1)
.FreezePanes = False
.FreezePanes = True
End With 
</code></pre>

<p>In this case I a''m getting error as <strong>Unable to set FreezePanes Property of the windows class</strong></p>

<p>and the AddWorksheetWithDefaults is a method that returns a object().
"
I tried following</p>

<p><strong>Try 1</strong></p>

<pre><code>AddWorksheetWithDefaults.Parent.Windows(1).Activate
With AddWorksheetWithDefaults.Parent.Windows(1).Rows("1:1").Select
.FreezePanes = False
.FreezePanes = True
End With
</code></pre>

<p><strong>Try 2</strong></p>

<pre><code>AddWorksheetWithDefaults.Parent.Windows(1).Activate
With AddWorksheetWithDefaults.Parent.Windows(1).Rows(1).Select
.FreezePanes = False
.FreezePanes = True
End With
</code></pre>

<p><strong>Try 3</strong></p>

<pre><code>AddWorksheetWithDefaults.Parent.Windows(1).Activate
With AddWorksheetWithDefaults.Parent.Windows(1).Rows("1:1")
.FreezePanes = False
.FreezePanes = True
End With
</code></pre>

<p>The options I tried gives me error as <strong>property or method not found</strong></p>

<p>Help me out. </p>