Home > database >  Debug.Print 2D array Value
Debug.Print 2D array Value

Time:12-24

Hello ı have strange array as variant. I want to print Name key value but ı don't know how to declare it. I try run the line below but it can't works.

Debug.Print vBodies(0,Name) or Debug.Print vBodies(0).Name

enter image description here

CodePudding user response:

This is not 100% solution but it might help to show the array fields name

          ' arr is the array to check
           Dim subarr as Variant
           For Each subarr In arr
                  Debug.Print subarr & " : " & arr(subarr)
           Next

CodePudding user response:

You need to cast vBodies(0) to SldWorks.Body2 Object to access its properties

Dim swBody As SldWorks.Body2
Set swBody = vBodies(0)
Debug.Print swBody.Name
  • Related