简体   繁体   English

Debug.Print 二维数组值

[英]Debug.Print 2D array Value

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

在此处输入图像描述

This is not 100% solution but it might help to show the array fields name这不是 100% 的解决方案,但它可能有助于显示数组字段名称

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

You need to cast vBodies(0) to SldWorks.Body2 Object to access its properties您需要将 vBodies(0) 转换为 SldWorks.Body2 对象以访问其属性

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM