当在excle中用同事编写的VBA工具时,一运行就报错:

user defined type not defined

查了报错的语句是:

Dim newFile  As MSXML2.DOMDocument

我的环境是windows10 + office2016,估计他之前用的是 Microsoft XML V3.0, 而我这里的是V6.0.

从网上查到的解决方案如下:如果在Tools>References中选择了Microsoft XML V6.0, 在声明变量时,要用如下的格式:

Dim newFile  As MSXML2.DOMDocument60

VBA "user defined type not defined" MSXML2.DOMDocument

相关文章: