开发者

Late Binding conversion for XML import syntax

开发者 https://www.devze.com 2023-03-03 07:36 出处:网络
I have an Access application that is really just an automation server for a bunch of office apps (Word, Excel, Ppt & Outlook), takes information imported, and gathered through forms and produces a

I have an Access application that is really just an automation server for a bunch of office apps (Word, Excel, Ppt & Outlook), takes information imported, and gathered through forms and produces all kinds of files.

It is not used as a database in the traditional sense, rather a remote file users utilize in the field for all the automation tricks, and then discard when they have all the files built then need.

So recently so folks here helped me out with converting to late binding as to save me from the brocken references on a target system killing the functionality. It is working great!

So now I have some xml import code that requires xml v5 to be set i开发者_Go百科n order to run. Now the problem I had before was the Excel, Powerpoint & Outlook object library references changing from office version to version (2003 = 11.0, 2007 - 12.0, etc), but I am wondering if I am going to have the same problem here. To make things more complicated I have no idea was Server/OS this may be run on (XP, Vista, 2003, 2008 SP2, etc). I honestly do not know if that will matter, so that is why I mention it.

So, if it in fact will create a problem, then does anyone have an idea of a late binding conversion example for declarations for this? It doesn't seem to be the same as creating and office app...

Sub PullingDataFromNodes()
   dim xmlDoc as MSXML2.DOMDocument50
   dim xmlNodeList As MSXML2.IXMLDOMNodeList
   dim myNode as MSXML2.IXMLDOMNode

   Set xmldoc = New MSXML2.DOMDocument50
   xmldoc.async = False
   xmldoc.Load ("C:/SomeFolder/xml.xml")

   Set xmlNodeList = xmldoc.SelectNodes("//DataFieldNode")
   Set myNode = xmlNodeList.item(0)

   'etc...more of the same....pull data from node, place data into variable, then place 
   '  data in variable into recordset, use it to update table kind of thing

So I tried to use CreateObject with this, and it doesn't seem to work....can anyone offer and advice with this?

I use xmlImport when I can with argus....but this particular solution is for data is the provided through a web app for which they neither embed the schema, and I don't have a style sheet or .xsd


I had similar code which uses MSXML2.DOMDocument.3.0, so I switched it to 5 and it still works. I don't know about the different versions. I can only suggest you try it this way and see what happens.

Sub PullingDataFromNodes()
   dim xmlDoc As Object
   dim xmlNodeList As Object
   dim myNode As Object

   Set xmldoc = CreateObject("MSXML2.DOMDocument.5.0")
   xmldoc.async = False
   xmldoc.Load "C:/SomeFolder/xml.xml"

   Set xmlNodeList = xmldoc.SelectNodes("//DataFieldNode")
   Set myNode = xmlNodeList.item(0)
0

精彩评论

暂无评论...
验证码 换一张
取 消