Sub GroupObject()
On Error GoTo errHandler:
Dim ShapeList() As String
Dim oShape As Shape
Dim count As Long
Dim rngGroup As Range
Dim strObjName As String
Dim strSlideNum As Long
Set rngGroup = ThisWorkbook.Sheets(SHEETCONFIG).Range("nrGroupStart")
strObjName = rngGroup.Offset(0, 2).Value
strSlideNum = rngGroup.Offset(0, 3).Value
Do While rngGroup <> ""
count = 0
Do
count = count + 1
ReDim Preserve ShapeList(1 To count)
ShapeList(count) = oPPTFile.Slides(strSlideNum).Shapes(strObjName).Name
Debug.Print strSlideNum&; " " & strObjName & " " & count
Set rngGroup = rngGroup.Offset(1, 0)
If rngGroup.Offset(0, 1) <> rngGroup.Offset(-1, 1) Then Exit Do
strObjName = rngGroup.Offset(0, 2).Value
strSlideNum = rngGroup.Offset(0, 3).Value
Loop Until rngGroup.Offset(0, 1) <> rngGroup.Offset(-1, 1)
oPPTFile.Slides(strSlideNum).Shapes.Range(ShapeList()).Group.Select
strObjName = rngGroup.Offset(0, 2).Value
strSlideNum = rngGroup.Offset(0, 3).Value
Loop
Exit Sub
errHandler:
MsgBox Err.Number & Err.Description
End Sub
|