添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Hello,

I've been running macros on a bunch of office word/excel files for years with no problem (Office versions 2003/2007/2010, interchangeably on a Windows 7 platform).  These macros use MSXML v6, and up until I got a new computer running Windows 10, I've never had an issue with the following:

Private variable_name As MSXML2.DOMDocument

Now, on Windows 10 (using Office 2007), I get a Compile Error: User-defined type not defined.  I checked my references, same stuff.  MSXML 6.0 is checked on both my old and new machine.  On my new machine, if I change the line to

Private variable_name As MSXML2.DOMDocument60

it works fine.  The problem is, these macros are needed on several other computers, none of which run windows 10, and when I tried to use that line of code on my old computer, it threw a Type Mismatch error.  My old computer is indicative of what the others will do.

How can I get the original code to work on my Windows 10 machine?

Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.

Set variable_name = CreateObject("MSXML2.DOMDocument")

[originally, it was Set variable_name = New MSXML.DOMDocument , which didn't work]

No idea why, but this works just fine everywhere.

Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation. Harassment is any behavior intended to disturb or upset a person or group of people. Threats include any threat of suicide, violence, or harm to another. Any content of an adult theme or inappropriate to a community web site. Any image, link, or discussion of nudity. Any behavior that is insulting, rude, vulgar, desecrating, or showing disrespect. Any behavior that appears to violate End user license agreements, including providing product keys or links to pirated software. Unsolicited bulk mail or bulk advertising. Any link to or advocacy of virus, spyware, malware, or phishing sites. Any other inappropriate content or behavior as defined by the Terms of Use or Code of Conduct. Any image, link, or discussion related to child pornography, child nudity, or other child abuse or exploitation.