Table of contents

OLEObject.ClassID 属性 (Visio)OLEObject.ClassID Property (Visio)

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

返回代表 ActiveX 控件或者嵌入或链接 OLE 对象的形状的类 ID 字符串。只读。Returns the class ID string of a shape that represents an ActiveX control or an embedded or linked OLE object. Read-only.


表达式ClassIDexpression . ClassID

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

返回值Return Value



如果该形状并不代表一个 ActiveX 控件或 OLE 2.0 嵌入或链接的对象,则ClassID属性会引发异常。一个形状表示一个 ActiveX 控件或 OLE 2.0 嵌入或链接对象,如果visTypeIsOLE2位 (&;H8000) 设置形状由返回的值中。ForeignTypeThe ClassID property raises an exception if the shape doesn't represent an ActiveX control or an OLE 2.0 embedded or linked object. A shape represents an ActiveX control or an OLE 2.0 embedded or linked object if the visTypeIsOLE2 bit (&;H8000) is set in the value returned by Shape . ForeignType .

ClassID返回格式的字符串:ClassID returns a string of the form:


该字符串标识为对象提供服务的应用程序。例如,它可能将 Microsoft Visio 页上的嵌入对象标识为 Microsoft Excel 对象。This identifies the application that services the object. It might, for example, identify an embedded object on a Microsoft Visio page as a Microsoft Excel object.

使用形状的对象属性来获得形状的自动化接口的对象表示之后,您可能希望获得形状的ClassID进程 Id属性,以确定这些方法和属性提供的界面。After using a shape's Object property to obtain an Automation interface on the object the shape represents, you might want to obtain the shape's ClassID or ProgID property to determine the methods and properties provided by the interface.


下面的 Microsoft Visual Basic for Applications (VBA) 宏显示如何获取OLEObjects集合的活动页面和打印在立即窗口中的每个OLEObject对象的ClassID 。本示例假定活动页具有至少一个 OLE 2.0 嵌入或链接的对象或 ActiveX 控件。The following Microsoft Visual Basic for Applications (VBA) macro shows how to get the OLEObjects collection of an active page and print the ClassID for each OLEObject object in the Immediate window. This example assumes that the active page has at least one OLE 2.0 embedded or linked object or an ActiveX control.

Public Sub ClassID_Example() 

 Dim intCounter As Integer 
 Dim vsoOLEObjects As Visio.OLEObjects 

 'Get the OLEObjects collection of the active page. 
 Set vsoOLEObjects = ActivePage.OLEObjects 

 'Step through the collection of OLEObjects on the page. 
 For intCounter = 1 To vsoOLEObjects.Count 
 Debug.Print vsoOLEObjects(intCounter).ClassID 
 Next intCounter 

End Sub
© 2018 Microsoft