PDA

View Full Version : [SOLVED:] Word controlling Excel using UsedRange.Rows no longer works in Windows 11



dbowlds
06-24-2025, 05:53 AM
Hello, all of the sudden, once I updated to Windows 11 on both my 32-bit and 64-bit Office laptops, when I try to compile my programs, every instance of this command fails:


lastRow = XLSheet.UsedRange.Rows(XLSheet.UsedRange.Rows.count).Row

The error message when trying to compile flags the second instance of ".UsedRange" in the above command and is:

Compile error:
Method or data member not found

lastRow is dimensioned as Long
The Excel objects are dimensioned as follows:


Dim xlApp As New Excel.Application
Dim xlBook As Excel.Workbook
Dim XLSheet As Excel.Worksheet

In all my applications that use the errored command, this command fails at the same point in each command.

I have searched the Internet and have not found this issue listed. I realize that .UsedRange is fickle, but it always compiled without a problem. Windows 11 has broken it somehow such that it seems to have been deprecated. I have the proper reference to the Excel Type library in the Word application. Everything worked properly in Windows 10.
Any ideas why?

dbowlds
06-24-2025, 09:22 AM
Update: for whatever reason, the fix was to remove the reference to Excel Type Object Library 16.0 debug, and then add the reference back in and lo and behold, it suddenly works!