# Activate Method

Activates the window that is represented by the Window object.

expression.Activate()

expression Required. An expression that returns a reference to the Window object.

## Security Level

2: Can be accessed only by forms running in the same domain as the currently open form, or by forms that have been granted cross-domain permissions.

## Remarks

The Activate method can be used only with the editing window types; if used with a designing window type, it will return an error.

To determine whether a window is the active window, use the Active property of the Window object.

## Example

In the following example, the Activate method of the Window object is used to activate a window that is associated with the view. Note the check of the window type.

    var objWindow;

    // Set a reference to a view's associated window.
    objWindow = XDocument.View.Window;

    if (objWindow.Type == 0)
    {
       // Make the window the active window.
       objWindow.Activate();
    }

    objWindow = null;

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp