Article ID: 180313
Article Last Modified on 1/22/2007
Private Sub Form_Current()
' If the control is empty.
If Me![OLETest].OLEType = acOLENone Then
With Me![OLETest]
' Set the object type to Embedded.
.OLETypeAllowed = acOLEEmbedded
' Set the class.
.Class = "Excel.Sheet"
' Create the embedded object.
.Action = acOLECreateEmbed
' Fit the object to the size of the control.
.SizeMode = acOLESizeStretch
End With
' Set the focus back to the ID field.
Me!ID.SetFocus
End If
End Sub
Table: tblOLETable
------------------------
Field Name: ID
Data Type: Text
Field Name: OLETest
Data Type: OLE Object
Private Sub Form_BeforeInsert(Cancel As Integer)
With Me![OLETest]
' Set the object type to embedded.
.OLETypeAllowed = acOLEEmbedded
' Set the class.
.Class = "Excel.Sheet"
' Create the embedded object.
.Action = acOLECreateEmbed
' Size the object to fit the control.
.SizeMode = acOLESizeStretch
End With
End Sub
Additional query words: custom activex active x
Keywords: kbbug kbpending KB180313