ExportXML メソッドを使用すると、テーブルに含まれるデータと書式設定を、指定した追加のデータと共にエクスポートできます。
エクスポートする追加データを指定するには、 CreateAdditionalData メソッドを使用して AdditionalData オブジェクトを作成する必要があります。 次に、 Add メソッドを使用して、メイン テーブルと共にエクスポートするテーブルを追加します。
次のプロシージャは、テーブルを XML にエクスポートするときに追加データを指定する方法の例を示します。 [受注] テーブルは他のいくつかのテーブルと共にエクスポートされます。 スキーマおよび書式設定も、それぞれ .xsd ファイルおよび .xsl ファイルとしてエクスポートされます。
Private Sub ExportRelTables()
' Purpose: Exports the Orders table as well as
' a number of related databases to an XML file.
' XSD and XSL files are also created.
Dim objAD As AdditionalData
' Create the AdditionalData object.
Set objAD = Application.CreateAdditionalData
' Add the related tables to the object.
With objAD
.Add "Order Details"
objAD(Item:="Order Details").Add "Order Details Details"
.Add "Customers"
.Add "Shippers"
.Add "Employees"
.Add "Products"
objAD(Item:="Products").Add "Product Details"
objAD(Item:="Products")(Item:="Product Details").Add _
"Product Details Details"
.Add "Suppliers"
.Add "Categories"
End With
' Export the Orders table along with the additional data.
Application.ExportXml acExportTable, "Orders", _
"C:\Orders.xml", "C:\OrdersSchema.xsd", _
"C:\OrdersStyle.xsl", AdditionalData:= objAD
End Sub
サポートとフィードバック
Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。