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

Can't ReDim, Erase, or assign to Variant that contains array whose element is With object

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

This error has the following causes and solutions:

  • You've attempted to ReDim, Erase, or assign to a Variant a variable whose element is a With object. For example, the following code produces this error:
Type Test
   Name as Integer
End Type

Sub Main()
   Dim c(0) As Test
   Dim e e = c
   With e(0)
      ReDim e(1)
   End With
End Sub

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

© 2018 Microsoft