Button.OLEType Property (2007 System)
Gets a value that represents the OLE object type.
Namespace: Microsoft.Office.Tools.Excel.Controls
Assembly: Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)
Syntax
'Declaration
Public ReadOnly Property OLEType As Object
'Usage
Dim instance As Button
Dim value As Object
value = instance.OLEType
public Object OLEType { get; }
public:
property Object^ OLEType {
Object^ get ();
}
public function get OLEType () : Object
Property Value
Type: System.Object
An xlOLEControl.
Examples
The following code example creates a Button control and assigns the button text to a string that describes the OLE object type of the button, as determined by the OLEType property value.
This example is for a document-level customization.
Private Sub DisplayOLEType()
Dim OleButton As Microsoft.Office.Tools.Excel.Controls.Button = _
Me.Controls.AddButton(Me.Range("B2", "C3"), "OleButton1")
Dim ControlType As String
Select Case OleButton.OLEType
Case Excel.XlOLEType.xlOLEControl
ControlType = "OLE control"
Case Excel.XlOLEType.xlOLEEmbed
ControlType = "OLE embedded control"
Case Excel.XlOLEType.xlOLELink
ControlType = "OLE linked control"
Case Else
ControlType = "Not assigned an OLE type"
End Select
oleButton.Text = controlType
End Sub
private void DisplayOLEType()
{
Microsoft.Office.Tools.Excel.Controls.Button oleButton =
this.Controls.AddButton(this.Range["B2", "C3"],
"oleButton1");
string controlType;
switch ((int)oleButton.OLEType)
{
case (int)Excel.XlOLEType.xlOLEControl:
controlType = "OLE control";
break;
case (int)Excel.XlOLEType.xlOLEEmbed:
controlType = "OLE embedded control";
break;
case (int)Excel.XlOLEType.xlOLELink:
controlType = "OLE linked control";
break;
default:
controlType = "Not assigned an OLE type";
break;
}
oleButton.Text = controlType;
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.