Skip to content

Files

Latest commit

 

History

History
59 lines (34 loc) · 2.57 KB

Excel.Workbook.XmlImport.md

File metadata and controls

59 lines (34 loc) · 2.57 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Workbook.XmlImport method (Excel)
vbaxl10.chm199226
vbaxl10.chm199226
Excel.Workbook.XmlImport
97964c82-1fbe-7060-0a90-23c190e0b398
05/29/2019
medium

Workbook.XmlImport method (Excel)

Imports an XML data file into the current workbook.

Syntax

expression.XmlImport (Url, ImportMap, Overwrite, Destination)

expression A variable that represents a Workbook object.

Parameters

Name Required/Optional Data type Description
Url Required String A uniform resource locator (URL) or a uniform naming convention (UNC) path to an XML data file.
ImportMap Required XmlMap The schema map to apply when importing the file. If the data was previously imported, contains a reference to the XmlMap object containing the data.
Overwrite Optional Variant If a value is not specified for the Destination parameter, this parameter specifies whether to overwrite data that has been mapped to the schema map specified in the ImportMap parameter. Set to True to overwrite the data or False to append the new data to the existing data. The default value is True.

If a value is specified for the Destination parameter, this parameter specifies whether to overwrite existing data. Set to True to overwrite existing data or False to cancel the import if data would be overwritten. The default value is True.
Destination Optional Variant Specifies the range where the list will be created. You only use the top-left corner of the range.

Return value

XlXmlImportResult

Remarks

This method allows you to import data into the workbook from a file path. Excel uses the first qualifying map found, or if the destination range is specified, Excel automatically lists the data.

Don't specify a value for the Destination parameter if you want to import data into an existing mapping.

The following conditions cause the XmlImport method to generate run-time errors:

  • The specified XML data contains syntax errors.

  • The import process was cancelled because the specified data cannot fit into the worksheet.

  • If no qualifying maps are found and the destination range was not specified.

Use the XmlImportXml method of the Workbook object to import XML data that was previously loaded into memory.

[!includeSupport and feedback]