PublishObject 属性 (Excel)PublishObject.Source property (Excel)

返回一个代表唯一名称的 Variant 值,该名称用于标识其 SourceType 属性值为 xlSourceRangexlSourceChartxlSourcePrintAreaxlSourceAutoFilterxlSourcePivotTablexlSourceQuery 的项。Returns a Variant value that represents the unique name that identifies items that have a SourceType property value of xlSourceRange, xlSourceChart, xlSourcePrintArea, xlSourceAutoFilter, xlSourcePivotTable, or xlSourceQuery.

语法Syntax

表达式expression.Source

_表达式_一个代表**PublishObject** 对象的变量。expression A variable that represents a PublishObject object.

注解Remarks

如果 SourceType 属性设置为 xlSourceRange,则此属性返回一个区域,该区域可以是一个定义名称。If the SourceType property is set to xlSourceRange, this property returns a range, which can be a defined name. 如果 SourceType 属性设置为 xlSourceChartxlSourcePivotTablexlSourceQuery,则此属性返回对象的名称,例如:图表名称、数据透视表名称或查询表名称。If the SourceType property is set to xlSourceChart, xlSourcePivotTable, or xlSourceQuery, this property returns the name of the object, such as a chart name, a PivotTable report name, or a query table name.

示例Example

本示例确定保存为网页的第一个图表 (第一个工作簿) 的唯一名称, 然后将该布尔变量blnChartFound设置为TrueThis example determines the unique name of the first chart (in the first workbook) saved as a webpage, and then it sets the Boolean variable blnChartFound to True. 如果文档中没有另存为图表组件的项目, blnChartFound则为FalseIf 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

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.