Workbooks.OpenXML method (Excel)

Opens an XML data file. Returns a Workbook object.

Syntax

expression.OpenXML (FileName, Stylesheets, LoadOption)

expression A variable that represents a Workbooks object.

Parameters

Name Required/Optional Data type Description
FileName Required String The name of the file to open.
Stylesheets Optional Variant Either a single value or an array of values that specify which XSL Transformation (XSLT) stylesheet processing instructions to apply.
LoadOption Optional Variant Specifies how Excel opens the XML data file. Can be one of the XlXmlLoadOption constants.

Return value

Workbook

Example

The following code opens the XML data file Customers.xml and displays the file's contents in an XML list.

Sub UseOpenXML() 
 Application.Workbooks.OpenXML _ 
 Filename:="Customers.xml", _ 
 LoadOption:=xlXmlLoadImportToList 
End Sub

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.