共用方式為


XmlMap.Import Method (Excel)

Imports data from the specified XML data file into cells that have been mapped to the specified XmlMap object.

Syntax

expression .Import(Url, Overwrite)

expression A variable that represents a XmlMap object.

Parameters

Name

Required/Optional

Data Type

Description

Url

Required

String

The path to the XML data to import. The path can be specified in Universal Naming convention (UNC) or Uniform Resource Locator (URL) format. The file can be an XML data file.

Overwrite

Optional

Variant

Set to True to overwrite existing data. Set to False to append to existing data. The default value is False.

Return Value

A XlXmlImportResult value that indicates the result of the method.

Remarks

This method returns one of the following XlXmlImportResult constants:

xlXmlImportElementsTruncated The contents of the specified XML data file have been truncated because the XML data file is too large for the worksheet.

xlXmlImportSuccess The XML data file was successfully imported.

xlXmlImportValidationFailed The data being imported failed schema validation, but was imported anyway.

If either of the following conditions is true, a runtime error will occur. If more than one condition is true, Excel returns a runtime error for the most severe (they are listed below with the most severe listed first):

  • If the XML data contains syntactical errors.

  • If import is cancelled because not all of the data could fit in the worksheet.

請參閱

概念

XmlMap Object Members

XmlMap Object