BoundObjectFrame 属性 (权限)BoundObjectFrame.Class property (Access)

可以使用Class属性来指定或确定嵌入的 OLE 对象的类名称。You can use the Class property to specify or determine the class name of an embedded OLE object. 读/写 StringRead/write String.



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


Class 属性设置是一个字符串表达式,由您或 Microsoft Access 在您创建或 OLE 对象粘贴。The Class property setting is a string expression supplied by you or Microsoft Access when you create or paste an OLE object.

类名定义的是 OLE 对象的类型。A class name defines the type of OLE object. 例如,Microsoft Excel 支持多种类型的 OLE 对象,包括工作表和图表。For example, Microsoft Excel supports several types of OLE objects, including worksheets and charts. 其类名分别为“Excel.Sheet”和“Excel.Chart”。Their class names are "Excel.Sheet" and "Excel.Chart" respectively.


[!注释] 要确定 OLE 对象的类名,请参阅提供该对象的应用程序的文档。To determine the class name of an OLE object, see the documentation for the application supplying the object.

从剪贴板中复制对象时, Class 属性设置将更新。The Class property setting is updated when you copy an object from the Clipboard. 例如, 如果将 Microsoft Excel 图表从剪贴板粘贴到以前包含 Excel 工作表的 OLE 对象中, 则Class属性设置将从 "Excel. Sheet" 更改为 "Excel. chart"。For example, if you paste a Microsoft Excel chart from the Clipboard into an OLE object that previously contained an Excel worksheet, the Class property setting changes from "Excel.Sheet" to "Excel.Chart". 您可以通过使用 Visual Basic 来控制 操作 属性设置为 acOLEPasteacOLEPasteSpecialDlg 粘贴剪贴板中的对象。You can paste an object from the Clipboard by using Visual Basic to set the control's Action property to acOLEPaste or acOLEPasteSpecialDlg.


[!注释] OLEClass 属性和 属性是相似但不是相同。The OLEClass property and the Class property are similar but not identical. OLEClass属性设置是 OLE 对象的一般说明, 而Class属性设置是用于引用 VISUAL Basic 中的 OLE 对象的名称。The OLEClass property setting is a general description of the OLE object, whereas the Class property setting is the name used to refer to the OLE object in Visual Basic. OLEClass 属性设置的示例包括 Microsoft Excel 图表、 Microsoft Word 文档和画笔图片。Examples of OLEClass property settings are Microsoft Excel Chart, Microsoft Word Document, and Paintbrush Picture.


下面的示例使用名为OLE1的未绑定对象框创建链接的 OLE 对象, 并调整该控件的大小, 以便在用户选择命令按钮时显示该对象的全部内容。The following example creates a linked OLE object by using an unbound object frame named OLE1 and sizes the control to display the object's entire contents when the user chooses a command button.

Sub Command1_Click 
 OLE1.Class = "Excel.Sheet" ' Set class name. 
 ' Specify type of object. 
 OLE1.OLETypeAllowed = acOLELinked 
 ' Specify source file. 
 OLE1.SourceDoc = "C:\Excel\Oletext.xls" 
 ' Specify data to create link to. 
 OLE1.SourceItem = "R1C1:R5C5" 
 ' Create linked object. 
 OLE1.Action = acOLECreateLink 
 ' Adjust control size. 
 OLE1.SizeMode = acOLESizeZoom 
End Sub

支持和反馈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.