Tuesday, 11 October 2016

XML : How to load a Word file a as XML in VBA?

I want to use VBA to load a Word file as XML to manipulate some Meta Tags later.

I tried the following from here:

  Dim XDoc As Object, root as Object    Set XDoc = CreateObject("MSXML2.DOMDocument")  XDoc.async = False: XDoc.validateOnParse = False  XDoc.Load ("URL to file")  Set root = XDoc.DocumentElement    'Get Document Elements  Set lists = XDoc.DocumentElement    'Get first child ( same as ChildNodes(0) )  Set getFirstChild = lists.FirstChild    

But I still get an error: Runtime error 91.

How can I load a Word file a as XML in VBA?

No comments:

Post a Comment