问题
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