msoPicture ungroup +10,000 shapes gives error

planmaat

New Member
Joined
Oct 31, 2016
Messages
1
Hi there,

From another application I import a group with a large number of rectangled shapes to Excel (a rasterized map). With VBA I loop a macro to ungroup to individual shapes (every 200 rectangles are grouped in a subgroup and ungouping gives a lot of Autoshapes which are deleted by the macro). The first 'group' to run into is always a msoPicture. When the msoPicture contains 10000+ shapes it suddenly gives an error, when it contains a number below 10,000 shapes shp.Ungoup works just fine.

After a lot of testing i found this limit of 10,000 shapes. Is this a known limitation? Any ideas for a bypass?

Code looks pretty simple, something like this:

Code:
Sub explodeGroup()
    For Each shp In ActiveSheet.Shapes
        If (shp.Type = 13) Or (shp.Type = 6) Then '13 = msoPicture, 6 = msoGroup
            shp.Ungroup
            Call explodeGroup
            Exit Sub
        ElseIf (shp.Type = 1) Then '1 = AutoShape
            shp.Delete
            Call explodeGroup
            Exit Sub
        Else
        End If
    Next
End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,215,526
Messages
6,125,328
Members
449,218
Latest member
Excel Master

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top