我需要在工作表上列出大量旧 ActiveX 命令按钮的标题。

我如何引用集合?

伪代码:

For each btn in Activesheet.CommandButtons
     Debug.Print btn.Caption
Next btn

最佳答案

Dim s As Worksheet

Set s = ActiveSheet

Dim o As OLEObject

For Each o In s.OLEObjects

    If TypeName(o.Object) = "CommandButton" Then
        Debug.Print o.Object.Caption
    End If

Next

关于vba - 如何获取命令按钮集合?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42135822/

10-10 18:48