Alternative to the Pictures collection in Excel 2010

ε祈祈猫儿з 提交于 2019-12-24 09:28:35

问题


Here is some code from an xls file. In Excel 2010 it doesn't work. I can't find the collection Pictures in the object explorer

Private Sub Worksheet_Calculate()

        Dim oPic As Picture
        'make them invisible
        For Each oPic In Me.Pictures
                    If Left(oPic.Name, 2) = "jq" Then
                                oPic.Visible = False
                    End If
        Next

end sub

What would the equivalent 2010 code be?


回答1:


Use this to loop through pictures in Excel

Sub Sample()
    Dim shp As Shape

    For Each shp In ActiveSheet.Shapes
        If shp.Type = msoPicture Then
            Debug.Print shp.Name
        End If
    Next
End Sub


来源:https://stackoverflow.com/questions/12280649/alternative-to-the-pictures-collection-in-excel-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!