SetFocus Method

Applies To

Window object.

Description

Moves the focus to the specified window.

Syntax

object.SetFocus

The object placeholder is an object expression that evaluates to an object in the Applies To list.

Remarks

Use the SetFocus method on windows that are already visible.

See Also

CodePane object, SetSelection method, Show method, Visible property.

Example

The following example uses the SetFocus method to move the focus to a particular member of the Windows collection; that is, it makes that window behave as if you had clicked its title bar with your mouse.

Application.VBE.Windows(9).SetFocus