简体   繁体   中英

“User-defined type not defined” error in Excel VBA after upgrade to Windows 10

A co-worker developed a part of Excel VBA-code for me. This code I have integrated in my code.

Both parts of code separate runs fine at Windows 7. Both parts of code separate runs fine at Windows 10. Both parts of code integrated runs fine at Windows 7. Although both parts of code integrated give an error at Windows 10.

The error is a Compile error "User-defined type not defined" directly after opening the file. It is caused by the line "Public objhttp As New XMLHTTP".

Option Explicit

Public objhttp As New XMLHTTP

Public url1 As String

Public src As String

'*******regualr Expression Variables*******

Public regx As New RegExp, matches As Object, match As Object

I have checked all the references under Tools in the Library from VBA. The installed references are the same in all 4 situations. In all situations I use Excel 2016.

Do you know what can be the cause for this?

Thank you!

I had a very similar problem when Windows 10 rolled out where I work. Something to do with their initial OoTB build of Windows 10 not including a particular msxml dll.

I fixed a few workbooks that this broke by replacing all of these:

MSXML.XMLHTTP
MSXML.ServerXMLHTTP
MSXML.DOMDocument

with these:

MSXML2.XMLHTTP60
MSXML2.ServerXMLHTTP60
MSXML2.DOMDocument60

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM