Hwnd Property of the Window Object in EXCEL 2010, 2007 ? (testers required)

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
9,619
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

Can anyone using excel 2007 or excel 2010 please confirm whether or not the Hwnd Property of the Window Object exists prior to excel 2013 (ie: prior to the introduction of the SDI interface)

Does the following compile in excel 2010,2007 ?
VBA Code:
MsgBox ThisWorkBook.Windows(1).hwnd
MsgBox ActiveWindow.hwnd

I believe this hwnd property didn't exist prior to excel 2013 but I am not entirely sure.

Thanks for your help.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
I am 99% sure you are correct, but will see if I still have 2010 installed anywhere.
 
Upvote 0
@ISY

I can't see how that link addresses the question?
 
Upvote 0
@ISY

Thanks for the link but that is talking about retrieving the Hwnd of controls not workbook windows

@RoryA

So am I, as I don't remember ever seeing that Property before.
Thanks
 
Upvote 0
Old Thread I realize.

I did test Excel 2007 32 bit and it errors.

Don't have 2010 to test. :(
 
Upvote 0
Application.hwnd exists, ThisWorkbook.hwnd does not exist in Excel 2010.
 
Upvote 0
Ok new test:

VBA Code:
Sub test()
'
' Excel 2007 32 bit / Windows 7 Results
'
'MsgBox ThisWorkbook.Windows(1).Hwnd             ' Error 438
'MsgBox Application.Windows(1).Hwnd              ' Error 438
'MsgBox ActiveWindow.Hwnd                        ' Error 438
'MsgBox Application.WorksheetFunction.Hwnd       ' Error 438
'MsgBox WorksheetFunction.Hwnd                   ' Error 438
MsgBox Application.Hwnd                         ' Results in 1311722
End Sub

Application.Hwnd does indeed yield a result in Excel 2007 32 bit Windows 7.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,393
Members
449,081
Latest member
JAMES KECULAH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top