gpt4 book ai didi

excel - 使用 For 调用数组中的子对象

转载 作者:行者123 更新时间:2023-12-04 22:22:16 25 4
gpt4 key购买 nike

我有以下数组,其中所有项目都是不同的子项。有没有办法做这样的事情?

Dim vetor As Variant
vetor = Array("OcultaProcConv", "AbakVs", "OcultaCSR", "GeraKermas", "Tempos", "OcultaDEP","OcultaAEC", "OcultaEscopia", "OcultaResultados", "MudaNumPag", "OcultaCP", "OcultaCertificado")

For contVetor = LBound(vetor) To UBound(vetor)
Call vetor(contVetor)
Next contVetor

最佳答案

你可以通过使用 CallByName 来做到这一点。 :

Dim vetor As Variant
vetor = Array("OcultaProcConv", "AbakVs", "OcultaCSR", "GeraKermas", "Tempos", "OcultaDEP","OcultaAEC", "OcultaEscopia", "OcultaResultados", "MudaNumPag", "OcultaCP", "OcultaCertificado")

For contVetor = LBound(vetor) To UBound(vetor)
CallByName Me, vetor(contVetor), VbMethod
Next contVetor

这假设潜艇在同一个模块中。

关于excel - 使用 For 调用数组中的子对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61761826/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com