Results 1 to 3 of 3

Thread: How do I delete a record from an array that has nested elements in it?

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2015
    Posts
    5

    Question How do I delete a record from an array that has nested elements in it?

    With the sub i have below...

    Code:
    Public Sub DeleteArrayItem(arr As Variant, index As Long)
    Dim i As Long
        For i = index To UBound(arr) - 1
            arr(i) = arr(i + 1)
        Next
        arr(UBound(arr)) = Empty
    End Sub
    I can successfully remove a record from a simple array. But when the array gets complicated, I get the following error.
    Only user-defined types defined in public object modules can be coerced to or from a variant or passed to late-bound functions
    Here is a pic of the array from a watch windows. Lets say I want to delete a3Tree(1) for example.

    Name:  tree.jpg
Views: 645
Size:  16.7 KB
    Last edited by AngryDev; Feb 23rd, 2018 at 04:05 PM. Reason: added more info

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width