测试代码如下:
Option Explicit
Private Sub Form_Load()
Dim a() As Variant
Dim i As Long
Const UB As Long = 10000000
ReDim a(UB)
Stop
For i = 0 To UB
a(i) = 1
Next
Stop
For i = 0 To UB
a(i) = 9.99999
Next
Stop
For i = 0 To UB
a(i) = "str"
Next
Stop
For i = 0 To UB
a(i) = "this is long string"
Next
Stop
End Sub