【发布时间】:2014-09-13 12:50:59
【问题描述】:
每当我使用 Access 在 VBA 上创建 XML 时,它都会创建一个在我正在使用的系统上不可读的 xml 文件..
这是我的 XML 代码
<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlns:od="urn:schemas-microsoft-com:officedata" generated="2014-07- 22T15:53:26">
<Customers>
<Idx>1</Idx>
<FirstName>David</FirstName>
<LastName>McCollum</LastName>
<IconIdx>0</IconIdx>
<PhoneNumber>02870 354244</PhoneNumber>
<Email></Email>
<Street></Street>
<City></City>
<State></State>
<ZipCode></ZipCode>
<Available>1</Available>
<SPIndex>0</SPIndex>
所以基本上我创建了我的表,然后使用按钮命令将其导出
Private Sub Export_Click()
Dim objOtherTbls As AdditionalData
Set objOtherTbls = Application.CreateAdditionalData
'Identify the tables or querys to export
objOtherTbls.Add "Customers"
'Here is where the export takes place
Application.ExportXML ObjectType:=acExportTable, _
DataSource:="Customers", _
DataTarget:="C:\Users\David PC\Desktop\CustomersTest.xml", _
AdditionalData:=objOtherTbls
MsgBox "Export operation completed successfully."
End Sub
基本上我有三件事需要做:)
Root 元素需要更改为“DatabaseData”而不是“dataroot”
我需要先删除子节点'xlmns:od'才能保存
我需要在保存之前删除子节点'generated'?
这些节点是“dataroot”的子节点吗?
任何帮助将不胜感激......
如果这没有意义我道歉..这是我第一次这样做:)
【问题讨论】: