0

Dim x As Variant Dim b As Variant x = Array() b = x

my point here is I want to transfer an array with ubound(-1). but it throws error when I'm passing x to b. Can you help explain how I can sort this? is this code "x = Array()" correct?

Thank you.

2 Answers 2

1

According to this MSDN page the cause of the error lies with the August 2019 Windows updates. There is a link to the Update Catalog if you scroll down the page and KBs are listed for various Windows versions. I've applied the fix for Win7 x64 and ...=Array() thankfully works again as before.

Sign up to request clarification or add additional context in comments.

Comments

0

It depends on how are you creating the empty array. Is this what you are trying?

Option Explicit

Sub Sample()
    Dim x As Variant
    Dim b As Variant
    Dim MyArray() As String

    MyArray = Split("")

    x = MyArray()
    b = x

    Debug.Print LBound(MyArray)
    Debug.Print UBound(MyArray)
    Debug.Print "-------"
    Debug.Print LBound(x)
    Debug.Print UBound(x)
    Debug.Print "-------"
    Debug.Print LBound(b)
    Debug.Print UBound(b)
End Sub

Output

0 
-1 
-------
0 
-1 
-------
0 
-1 

2 Comments

Hi, someone said to me the cause of it is the windows update. Thank you anyway :)
Not that I am aware of but I hope you got an answer to your query?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.