WindowList

Syntax

WindowList Number

Remarks

Activates a window listed on the Window menu. The instruction WindowList 1 activates the first window in the list, WindowList 2 activates the second window, and so on through the number of open windows. If no windows are listed, or if Number is greater than the number of open windows, an error occurs.

Example

This example activates the first window containing the document TEST.DOC. The InStr() function checks for the string "TEST.DOC" in the window name, which may include extra text such as "(Read-Only)" if the document is read-only, or ":2" if the document is open in more than one window.


numwin = CountWindows()
If numwin <> 0 Then
    i = 1
    While i <= numwin And leave <> 1
        winname$ = WindowName$(i)
        If InStr(winname$, "TEST.DOC") Then leave = 1
        If leave <> 1 Then i = i + 1
    Wend
End If
If InStr(winname$, "TEST.DOC") Then
    WindowList i
Else
    MsgBox "There is no window containing TEST.DOC."
End If

See Also

CountWindows(), Window(), WindowName$(), WindowNumber, WindowPane()