For Each Statement

Syntax

For Each var In items
statement
s
Next [var]

Group

Flow Control

Description

Execute statements for each item in items.

Parameter Description
ar This is the iteration variable.
items This is the collection of items to be done.

See Also: Do, For, Exit For, While.

Example

Sub Main
Dim
Document As Object
For
Each Document In App.Documents
Debug
.Print Document.Title
Next Document
End
Sub