vba 读取xml数据的VBA基本脚本??学习这种方法的资源?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2181739/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 11:17:39  来源:igfitidea点击:

VBA basic script for reading xml data?? Resource for learning this method?

xmlvbavbscriptexcel-vbaxsd

提问by Justin

So I was just looking for basic examples of reading xml structure data with visual basic subs/scripts.

所以我只是在寻找使用可视化基本订阅/脚本读取 xml 结构数据的基本示例。

specifically, if possible, how can i take structure data of xml, read the data with some vba, and lay it into excel spreadsheets?

具体来说,如果可能的话,我如何获取xml的结构数据,用一些vba读取数据,并将其放入excel电子表格中?

or just a learning resource for this type of thing. thanks very much!

或者只是此类事情的学习资源。非常感谢!

回答by Jason Rowe

These three topics will help you get started.

这三个主题将帮助您入门。

1) Load the XML using MSXMLhint - XMLDOC.Load ("D:\folder\yourXML.xml")

1) 使用MSXML提示加载 XML - XMLDOC.Load ("D:\folder\yourXML.xml")

2) Read the data with XPathor XML navigator

2) 使用XPath或 XML 导航器读取数据

3) Build Excel Spreadsheet Using Microsoft Excel Object Model

3) 使用Microsoft Excel 对象模型构建 Excel 电子表格

回答by Dick Kusleika

http://www.dailydoseofexcel.com/archives/2009/06/16/reading-xml-files-in-vba/

http://www.dailydoseofexcel.com/archives/2009/06/16/reading-xml-files-in-vba/

http://www.dailydoseofexcel.com/archives/2010/01/21/culling-you-rss-feeds/

http://www.dailydoseofexcel.com/archives/2010/01/21/culling-you-rss-feeds/

These aren't tutorials, just a couple of examples of XML in Excel that might help you identify the objects properties and methods. The first one from 2009 was my first attempt (read: it's terrible) but the comments were helpful for me so they might be helpful for you too.

这些不是教程,只是 Excel 中的几个 XML 示例,可以帮助您识别对象的属性和方法。2009 年的第一个是我的第一次尝试(阅读:这太糟糕了)但是评论对我有帮助,所以它们也可能对你有帮助。