This documentation is archived and is not being maintained.

QueryTable.WebFormatting Property

Office 2007
Returns or sets a value that determines how much formatting from a Web page, if any, is applied when you import the page into a query table. Read/write XlWebFormatting.



expression   A variable that represents a QueryTable object.


Use this property only when the query table’s QueryType property is set to xlWebQuery and the query returns an HTML document.

XlWebFormatting can be one of these XlWebFormatting constants.

If you import data using the user interface, data from a Web query or a text query is imported as a QueryTable object, while all other external data is imported as a ListObject object.

If you import data using the object model, data from a Web query or a text query must be imported as a QueryTable, while all other external data can be imported as either a ListObject or a QueryTable.

The WebFormatting property applies only to QueryTable objects.


This example adds a new Web query table to the first worksheet in the first workbook, imports all of the Web page formatting applied to the data, and then refreshes the query table.

Visual Basic for Applications
Set shFirstQtr = Workbooks(1).Worksheets(1) 
Set qtQtrResults = shFirstQtr.QueryTables _
    .Add(Connection := "URL;http://datasvr/98q1/19980331.htm", _
        Destination := shFirstQtr.Cells(1,1))
With qtQtrResults
    .WebFormatting = xlAll
End With