It's possible to assign "whole" arrays "directly" to an Variant variable in VBA (usually used for reading/writing whole ranges e.g. varRange = Range("A1:A3").Value
):
Dim varVariable As Variant
varVariant = Array("a", "b", "c")
Dim arrVariant() As Variant
arrVariantVarSize = Array("d", "e", "f")
Is it possible to do that with an array consisting of a regular data type (not necessarily just string or integer)? Similar to this (which does not work since array() returns a variant array that can't be assigned to a string or integer array):
Dim arrString(2) As String
arrString = Array("a", "b", "c") '-> throws an exception
Dim arrInteger (2) As Integer
arrInteger = Array(1, 2, 3) '-> throws an exception
Instead of this:
Dim arrString(2) As String
arrString(0) = Array("a")
arrString(1) = Array("b")
arrString(2) = Array("c")
Dim arrInteger(2) As String
arrInteger(0) = Array(1)
arrInteger(1) = Array(2)
arrInteger(2) = Array(3)