AppActivate (statement)

<< Click to Display Table of Contents >>

AppActivate (statement)

AppActivate "Title"

Activates an already running application, i.e., brings the application window to the front and sets the focus to the application.

The string Title is the application name as it appears in the title bar.

See also: AppPlanMaker, AppTextMaker, CreateObject, GetObject, Shell

Example:

Sub Main

 X = Shell("Calc.exe", 1)        ' Invoke the Calculator application

 For i = 1 To 5

       SendKeys i & "{+}", True      ' Send keystrokes

 Next i

 Msg = "The calculator will be closed now."

 MsgBox Msg

 AppActivate "Calculator"        ' Set the focus to the calculator

 SendKeys "%{F4}", True          ' Send Alt+F4 to close the application

End Sub