cancel
Showing results for 
Search instead for 
Did you mean: 

Freeze Panes

KULRANJANSINGH1
Level 2
I want to create a page in the ms excel vbo to create freeze panes i have recorded a macro and the code for it is

With ActiveWindow
.SplitColumn = 0
.SplitRow = 1
End With
ActiveWindow.FreezePanes = True


The issue is use of ActiveWindow as it can't be use like ActiveWorkbook or ActiveWorksheet, Is there any way we can ActivateWindow

------------------------------
KULRANJAN SINGH NEGI
Associate Professional Programmer Analyst
DXC Technology
Asia/Kolkata
------------------------------
1 REPLY 1

Hi Kulranjan,

ActiveWindow, ActiveWorkbook, ActiveWorksheet works in the context of macro(VBA) directly.

When developing the code stage you can use ->

Dim excel as Object = GetInstance(handle)
excel.ActiveWindow.SplitColumn = 0
excel.ActiveWindow.SplitRow = 1
excel.ActiveWindow.FreezePanes = True

Note the reference to the Excel instance in the VB.NET code.

------------------------------
Shashank Kumar
DX Integrations Partner Consultant
Blue Prism
Asia/Singapore
+6581326707
------------------------------