Wie kann ich die Gruppe eine Reihe von Formen, die programmgesteuert in excel 2007 vba?

Ich bin der Iteration über die Daten auf der Elektrischen Tabellen-Blatt und erstellen von Formen auf einem Form Blatt. Sobald die Formen geschaffen sind, möchte ich programmatisch zusammenfassen. Allerdings kann ich nicht herausfinden, die richtige syntax. Die Formen gibt es, ausgewählt, und wenn ich auf die Schaltfläche Gruppe, diese Gruppe perfekt. Aber mit dem folgenden code bekomme ich

Runtime Error 438-Objekt unterstützt diese Methode oder Eigenschaft.

Ich bin stützend diesen code auf vba-Beispiele aus dem web - ich bin nicht besonders vba-Programmierer. Was ist der richtige Weg, dies zu tun? Ich arbeite mit excel 2007 und Wechsel in den excel-Versionen eine option nicht.

problematisch snippet :

Set shapeSheet = Worksheets("Shapes")
With shapeSheet
 Selection.ShapeRange.Group.Select
End With

Kontext :

Dim shapeSheet As Worksheet
Dim tableSheet As Worksheet
Dim shpGroup As Shape

Set shapeSheet = Worksheets("Shapes")
Set tableSheet = Worksheets("Electrical Tables")


With tableSheet
    For Each oRow In Selection.Rows
            rowCount = rowCount + 1
            Set box1 = shapeSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 50, 50 + ((rowCount - 1) * 14), 115, 14)
            box1.Select (False)
            Set box1Frame = box1.TextFrame
            Set box2 = shapeSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 165, 50 + ((rowCount - 1) * 14), 40, 14)
            box2.Select (False)
            Set box2Frame = box2.TextFrame
     Next
End With
Set shapeSheet = Worksheets("Shapes")
With shapeSheet
 Selection.ShapeRange.Group.Select
End With

InformationsquelleAutor Andrew Bucknell | 2011-06-05

Schreibe einen Kommentar