SourceType Property

Microsoft Excel Visual Basic

Returns a one of the XlListObjectSourceType constants indicating the current source of the list. Read-only.

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

expression.SourceType

expression    Required. An expression that returns a ListObject object.

ShowSourceType property as it applies to the PivotCache object.

Returns a value that identifies the type of item being published. Read-only 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.

ShowSourceType property as it applies to the PublishObject object.

Returns a value that identifies the type of item being published. Read-only 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