Excel-VBA file operation 3

Source: Internet
Author: User

Stylesheets variant type. Optional. An array of single values or values, used to specify the XSL conversion (XSLT) style table processing instructions to be applied.

Loadoption variant type, conversion. Specifies how to open an XML data file in Excel. Can be one of the xlxmlloadoption constants.

Xlxmlloadoption can be one of the following xlxmlloadoption constants:

Xlxmlloadimporttolist puts the content of the XML data file in the XML list.

Xlxmlloadmapxml shows the XML data file architecture in the "XML structure" task pane.

Xlxmlloadopenxml open the XML data file. The file content is expanded.

Xlxmlloadpromptuser prompts you to select the file opening method.

Example

The following code opens the XML data file "MERs. xml" and displays the content of this file in the XML list.

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

The opendatabase method syntax is as follows:

Workbooks. opendatabase (filename, commandtext, commandtype, backgroundquery, importdataas)

Filename string type, required. The connection string.

Commandtext variant type. Optional. Query command text.

Commandtype variant type. Optional. Query command type. The following command types are available: Default, SQL, and table.

(Optional) Type of backgroundquery variant. The background of the query.

Optional. importdataas variant type. Determine the Query format.

Example

In this example, the "northwind. mdb" file is opened in Excel.

Sub OpenDatabase()
Workbooks.OpenDatabase FileName:="C:northwind.mdb"
End Sub

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.