SourceType Property [Excel 2003 VBA Language Reference]

SourceType property as it applies to the ListObject object.

XlListObjectSourceType

XlListObjectSourceType can be one of these XlListObjectSourceType constants.
xlSrcExternal
xlSrcRange
xlSrcXml

expression.SourceType

expression Required. An expression that returns a ListObject object.

SourceType property as it applies to the PivotCache object.

XlPivotTableSourceType

XlPivotTableSourceType can be one of these XlPivotTableSourceType constants.
xlConsolidation
xlDatabase
xlExternal
xlPivotTable
xlScenario

expression.SourceType

expression Required. An expression that returns a PivotCache object.

SourceType property as it applies to the PublishObject object.

XlSourceType

XlSourceType can be one of these XlSourceType constants.
xlSourceChart
xlSourcePrintArea
xlSourceRange
xlSourceWorkbook
xlSourceAutoFilter
xlSourcePivotTable
xlSourceQuery
xlSourceSheet

expression.SourceType

expression Required. An expression that returns a PublishObject object.

Example

This example determines the unique name of the first chart (in the first workbook) saved as a Web page, and then it sets the Boolean variable blnChartFound to True. If no items in the document have been saved as Chart components, blnChartFound is False.

blnChartFound = False
For Each objPO In Workbooks(1).PublishObjects
    If objPO.SourceType = xlSourceChart Then
        strFirstPO = objPO.Source
        blnChartFound = True
        Exit For
    End If
Next objPO

The following sample code returns a XlListObjectSourceType constant indicating the source of the default list on Sheet1 of the active workbook.

Sub Test ()   
   Dim wrksht As Worksheet
   Dim oListObj As ListObject
   
   Set wrksht = ActiveWorkbook.Worksheets("Sheet1")
   Set oListObj = wrksht.ListObjects(1)
   
   Debug.Print oListObj.SourceType
End Sub

Applies to | ListObject Object | PivotCache Object | PublishObject Object

See Also | Saving Documents as Web Pages