web analytics

How To Reference MSXML within VBA Projects?

Options

codeling 1599 - 6654
@2019-11-27 11:11:26

MSXML can be used when working within applications that support Visual Basic for Applications (VBA), such as Microsoft Office 2010, Microsoft Office 2013 or Microsoft Office 2016.

For example, to set a reference to MSXML in a VBA project within Microsoft Word, do the following:

  1. Open Visual Basic Editor in Microsoft Word by editing a Macro.

  2. Click Tools and then References. In the list of available references, select from any of the following versions of MSXML you have installed and wish to reference in your VBA project:

    • Microsoft XML, v 3.0.

    • Microsoft XML, v 6.0 

  3. Click OK.

Once this reference is made, you can call and use MSXML application programming interfaces directly from within your VBA project code modules.

@2019-11-27 16:06:07

Microsoft allows multiple versions of MSXML installed side-by-side in your computer. If you want to find out which versions of MSXML are installed on your system, fire up the RegEdit utility and navigate to the HKEY_CLASSES_ROOT\Msxml2.DOMDocument entry. Mxsml2.DOMDocument is the version-independent name of the COM class for the XML DOM in MSXML. Just below that entry you should see one or more version-dependent COM class names such as Msxml2.DOMDocument.3.0, Msxml2.DOMDocument.6.0 and so forth, a different one for each version of MSXML installed.

From above figure, you can see that the MSXML 3.0 and 6.0 are installed, and from the value of the Msxml2.DOMDocument\CurVer key you can tell that MSXML 3.0 is the default (version independent) one. When an XML file is dragged and dropped on Internet Explorer, it is displayed using MSXML 3.0.

By the way, when Internet Explorer displays an XML file, it is actually styling it with IE's default XSLT stylesheet. The default XSLT stylesheet transforms arbitrary XML into a Dynamic HTML (DHTML) document which provides fonts and colors and allows you to expand and collapse elements.

If you want to find out where the MSXML3.dll is located, you can click on Msxml2.DOMDocument.3.0\CLSID:Then you can search the CLSID under the key HKEY_CLASSES_ROOT\CLSID to find out the location:

 

 

Comments

You must Sign In to comment on this topic.


© 2024 Digcode.com