Table of contents
TOC
折叠目录
展开目录

InvisibleApp.CellChanged 事件 (Visio)InvisibleApp.CellChanged Event (Visio)

office 365 dev account|上次更新日期: 2018/3/13
|
2 参与人员

在文档中单元格内的值更改之后,发生此事件。Occurs after the value changes in a cell in a document.

语法Syntax

专用子_表达式__CellChangedByVal 单元格为 [IVCELL]Private Sub expressionCellChanged( **_ByVal Cell As [IVCELL]** )

表达式_一个表示InvisibleApp对象的变量。_expression A variable that represents an InvisibleApp object.

参数Parameters

名称Name必需/可选Required/Optional数据类型Data Type说明Description
单元格Cell必需Required[IVCELL][IVCELL]值已更改的单元格。The cell whose value has changed.

注解Remarks

如果您使用 Microsoft Visual Basic 或 Visual Basic for Applications (VBA),则此主题中的语法描述的是一种通用而有效的事件处理方法。If you are using Microsoft Visual Basic or Visual Basic for Applications (VBA), the syntax in this topic describes a common, efficient way to handle events.

如果您想要创建您自己的事件对象,使用添加AddAdvise方法。若要创建一个事件对象,运行加载项,请使用Add方法,应用到事件列表集合。若要创建一个事件对象,该对象接收通知,请使用AddAdvise方法。若要查找您想要创建的事件的事件代码,请参阅事件代码If you want to create your own Event objects, use the Add or AddAdvise method. To create an Event object that runs an add-on, use the Add method as it applies to the EventList collection. To create an Event object that receives notification, use the AddAdvise method. To find an event code for the event you want to create, seeEvent codes.

请注意 您可以使用 VBA WithEvents变量CellChanged事件接收器。Note You can use VBA WithEvents variables to sink the CellChanged event.

出于性能考虑,文档对象的事件集不包括CellChanged事件。若要从文档对象 (和 VBA 项目中的状态报告对象) 水池的CellChanged事件,必须使用AddAdvise方法。For performance considerations, the Document object's event set does not include the CellChanged event. To sink the CellChanged event from a Document object (and the ThisDocument object in a VBA project), you must use the AddAdvise method.

示例Example

本 VBA 模块演示了如何使用CellChanged事件捕获到形状的单元格的更改。This VBA module shows how to use the CellChanged event to trap changes to a shape's cells.


Private WithEvents vsoApplication As Visio.Application 

Public Sub CellChanged_Example() 

 Dim vsoShape As Visio.Shape 

 'Set a module-level variable to trap application-level events. 
 Set vsoApplication = Application 

 'Draw a shape. 
 Set vsoShape = ActivePage.DrawRectangle(1, 2, 2, 1) 

 'Change a cell (to trigger a CellChanged event). 
 vsoShape.Cells("Width").Formula = 5 

End Sub 

Private Sub vsoApplication_CellChanged(ByVal vsoCell As IVCell) 

 Debug.Print vsoCell.Shape.Name &; " " &; vsoCell.Name &; " changed to =" &; vsoCell.Formula 

End Sub
© 2018 Microsoft