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

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

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