Access/VBA Library

FromCollection Method

Creates an array from the specified Collection.

Syntax

array_.FromCollection( AnCollection )
Parameters
Name Type Description
array_   The name of an object of type array_
AnCollection Variant Required. The Collection to be used as the source of the array to be created.

Remarks

  • If AnCollection is not the type Array the error "Type mismatch" is raised.
  • AnCollection should not contain objects.
Example
  Dim x As New Array_
  Dim c As New Collection
  c.Add "foo"
  c.Add 2
  c.Add "bar"
  c.Add 4

  ' Result :
  'Array (
  ' [1] = > foo
  ' [2] = > 2
  ' [3] = > bar
  ' [4] = > 4
  ')