BoundObjectFrame.Class 屬性 (Access)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.

語法Syntax

運算式類別expression.Class

_運算式_代表**BoundObjectFrame** 物件的變數。expression A variable that represents a BoundObjectFrame object.

註解Remarks

Class 屬性設定值是建立或貼上 OLE 物件時,由您或 Microsoft Access 所提供的字串運算式。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 來設定控制項的 Action 屬性為 acOLEPasteDisplaytype 貼上剪貼簿中的物件。You can paste an object from the Clipboard by using Visual Basic to set the control's Action property to acOLEPaste or acOLEPasteSpecialDlg.

注意

[!注意事項] OLEClass 屬性和 Class 屬性是類似,但不是相同。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.

範例Example

下列範例會使用名為稱為 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.