What is the parent of ActiveWindow?
It's not available as ThisWorkbook.ActiveWindow or
Application.ActiveWindow .
Thanks.
Peter T - 25 Jan 2007 22:32 GMT
I can only describe parentage of Excel's Windows as ambigous!
Assuming there is an active workbook, instead of ActiveWindow try -
Activeworkbook.windows(1)
which should return its expected parent.
Curiosity, why do you need to know its parent.
FWIW
b = ActiveWindow Is Nothing
is one way to determine there are no visible workbooks
Regards,
Peter T
> What is the parent of ActiveWindow?
>
> It's not available as ThisWorkbook.ActiveWindow or
> Application.ActiveWindow .
>
> Thanks.
gimme_this_gimme_that@yahoo.com - 25 Jan 2007 23:51 GMT
I'm trying to create a FreezePane from VBScript without creating an
Excel Macro and calling that.
> Curiosity, why do you need to know its parent.
Sir Tom - 26 Jan 2007 04:09 GMT
Might look at this posting "VB code to FreezePane a row in an Excel
spreadsheet".
http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q
_21165508.html
> I'm trying to create a FreezePane from VBScript without creating an
> Excel Macro and calling that.
>
> > Curiosity, why do you need to know its parent.
Sir Tom - 25 Jan 2007 22:40 GMT
If your trying to get the Workbook name it would be
ThisWorkBook.Name
or the active worksheet would be
ActiveSheet.Name
> What is the parent of ActiveWindow?
>
> It's not available as ThisWorkbook.ActiveWindow or
> Application.ActiveWindow .
>
> Thanks.
NickHK - 26 Jan 2007 03:39 GMT
ActiveWindow.Parent.Name
or
Application.Windows(1).Parent.Name
And to go the other way:
ThisWorkbook.Windows(1).Caption
Note that a WB may have more than 1 window. This is shown by
Thisworkbook.Windows.Count and the .WindowNumber property of each of these
windows.
But I'll certainly agree with Peter that the way WBs and Windows are related
is not always clear.
NickHK
> What is the parent of ActiveWindow?
>
> It's not available as ThisWorkbook.ActiveWindow or
> Application.ActiveWindow .
>
> Thanks.