Reputation: 526
I would like do detele all picture png from an active window from MS Visio in VBA so I tried this:
Sub DeleteAllShapes()
Dim vsoSelection As Visio.Selection
Set vsoSelection = ActiveWindow.Selection
Dim shp As Shape
For Each shp In vsoSelection
If shp.Type <> msoPicture Then shp.Delete
Next shp
End Sub
But it deletes just the last select and not all in the page
Upvotes: 0
Views: 125
Reputation: 1200
When deleting shapes you need to use a plain For loop and count backwards.
For shp = vsoSelection.Count To 1 Step -1
more code
Next shp
Upvotes: 1