Table of contents
TOC
Collapse the table of content
Expand the table of content

For Each may not be used on array of user-defined type or fixed-length strings

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

For Each constructs are only valid forcollections andarrays of intrinsic types, including arrays of objects. Also, arrays of fixed-length strings can't be iterated using ForEach. This error has the following causes and solutions:

  • The elements of the array in your For Each construct have auser-defined type.

    Use an ordinary For...Next loop to iterate the elements of the array.

  • The elements of the array in your For Each construct have a fixed-length string type. Use an ordinary For...Next loop to iterate the elements of the array.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

© 2018 Microsoft