我编写了一个 VBA 宏来加载和解析 XML 文件。这个确切的代码已经运行了一段时间,但现在它不再起作用了。我已经在运行 Excel 2013 64 位的两台不同的计算机上对其进行了测试。它失败的代码如下:
Public Sub RunClashImport()
'This subroutine will import an XML clash report, parse it, and write it to our workbook
Dim iRow As Integer
'Get XML file
Dim xmlFile As MSXML2.DOMDocument60
Set xmlFile = New MSXML2.DOMDocument60
如果我注释掉 Set 命令,代码将继续。它不会引发错误,它会使 Excel 完全崩溃。上面的代码是宏开始的地方,在它之前没有运行任何代码。我已经设置了对 MSXML v6.0 的引用