That will be a tricky project!
Here is how to group shapes on a slide that are Blue (RGB(68, 114, 196) which might give you some pointers
Sub Grouper()
Dim rayBlue() As Long
Dim osld As Slide
Dim L As Long
ReDim rayBlue(1 To 1)
Set osld = ActivePresentation.Slides(1)
For L = 1 To osld.Shapes.Count
If osld.Shapes(L).Fill.ForeColor.RGB = RGB(68, 114, 196) Then
rayBlue(UBound(rayBlue)) = L
ReDim Preserve rayBlue(1 To UBound(rayBlue) + 1)
End If
Next L
'Remove last unwanted blank
ReDim Preserve rayBlue(1 To UBound(rayBlue) - 1)
ActivePresentation.Slides(1).Shapes.Range(rayBlue).Group
End Sub