XML VBA Access 2010 导入

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16522465/
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 21:04:28  来源:igfitidea点击:

XML VBA Access 2010 import

xmlvbams-access-2007access-vbaxml-import

提问by Paris31

I want to integrate in my code VBA an instruction to import XML files. In the elsebranch of my condition, I want to add a command to import the XML files. Could you suggest me something (a VBA instruction which do the import) ?

我想在我的代码 VBA 中集成一个导入 XML 文件的指令。在else我的条件分支中,我想添加一个命令来导入 XML 文件。你能给我建议一些东西吗(执行导入的 VBA 指令)?

   Private Sub Commande0_Click()
      Dim rep As String
      rep = Dir("C:\Users\Toufik\Desktop\XML\*.*", vbDirectory)
      Do While (rep <> "")
         If (GetAttr("C:\Users\Toufik\Desktop\XML\" & rep) And vbDirectory) = vbDirectory Then
            MsgBox "Directory " & rep
         Else
            MsgBox "File " & rep
         End If 
         rep = Dir
      Loop
   End Sub

回答by Gord Thompson

If you want to import XML data into Access using VBA you should check out the Application.ImportXMLmethod, described here:

如果要使用 VBA 将 XML 数据导入 Access,则应查看Application.ImportXML此处描述的方法:

http://msdn.microsoft.com/en-us/library/ff823157%28v=office.14%29.aspx

http://msdn.microsoft.com/en-us/library/ff823157%28v=office.14%29.aspx