Share via


Button.Activate Method (2007 System)

Activates the Button.

Namespace:  Microsoft.Office.Tools.Excel.Controls
Assembly:  Microsoft.Office.Tools.Excel.v9.0 (in Microsoft.Office.Tools.Excel.v9.0.dll)

Syntax

'Declaration
Public Function Activate As Object
'Usage
Dim instance As Button 
Dim returnValue As Object 

returnValue = instance.Activate()
public Object Activate()
public:
Object^ Activate()
public function Activate() : Object

Return Value

Type: System.Object
true if the Button is activated; otherwise, false.

Examples

The following code example adds two Button controls to a worksheet and then programmatically activates the second button by using the Activate method.

This example is for a document-level customization.

Private Sub ActivateControl()
    Dim Button1 As Microsoft.Office.Tools.Excel.Controls.Button = _
        Me.Controls.AddButton(Me.Range("B2", "C3"), "Button1")
    Button1.Text = "Button 1" 

    Dim Button2 As Microsoft.Office.Tools.Excel.Controls.Button = _
        Me.Controls.AddButton(Me.Range("B5", "C6"), "Button2")
    Button2.Text = "Button 2"

    Button2.Activate()
End Sub
private void ActivateControl()
{
    Microsoft.Office.Tools.Excel.Controls.Button button1 =
        this.Controls.AddButton(this.Range["B2", "C3"],
        "button1");
    button1.Text = "Button 1";

    Microsoft.Office.Tools.Excel.Controls.Button button2 =
        this.Controls.AddButton(this.Range["B5", "C6"],
        "button2");
    button2.Text = "Button 2";

    // Programmatically activate the second button only.
    button2.Activate();
}

.NET Framework Security

See Also

Reference

Button Class

Button Members

Microsoft.Office.Tools.Excel.Controls Namespace