Share via


_Workbook.XmlImport Method

Imports an XML data file into the current workbook. Returns XlXmlImportResult.

Namespace:  Microsoft.Office.Interop.Excel
Assembly:  Microsoft.Office.Interop.Excel (in Microsoft.Office.Interop.Excel.dll)

Syntax

'Declaration
Function XmlImport ( _
    Url As String, _
    <OutAttribute> ByRef ImportMap As XmlMap, _
    Overwrite As Object, _
    Destination As Object _
) As XlXmlImportResult
'Usage
Dim instance As _Workbook
Dim Url As String
Dim ImportMap As XmlMap
Dim Overwrite As Object
Dim Destination As Object
Dim returnValue As XlXmlImportResult

returnValue = instance.XmlImport(Url, _
    ImportMap, Overwrite, Destination)
XlXmlImportResult XmlImport(
    string Url,
    out XmlMap ImportMap,
    Object Overwrite,
    Object Destination
)

Parameters

  • Url
    Type: System.String

    Required String. A uniform resource locator (URL) or a uniform naming convention (UNC) path to a XML data file.

  • Overwrite
    Type: System.Object

    Optional Boolean. If a value is not specified for the Destination parameter, then this parameter specifies whether or not 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, then this parameter specifies whether or not 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
    Type: System.Object

    Optional Range. The data will be imported into a new XML list at the range specified.

Return Value

Type: Microsoft.Office.Interop.Excel.XlXmlImportResult

Remarks

XML features, except for saving files in the XML Spreadsheet format, are available only in Microsoft Office Professional Edition 2003 and Microsoft Office Excel 2003.

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

The following conditions will 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.

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

See Also

Reference

_Workbook Interface

_Workbook Members

Microsoft.Office.Interop.Excel Namespace