In diesem Beispiel wird das Füllmuster für die erste und die dritte Form in myDocument festgelegt.
Set myDocument = Worksheets(1) myDocument.Shapes.Range(Array(1, 3)) _ .Fill.Patterned msoPatternHorizontalBrick
In diesem Beispiel wird das Füllmuster für die Formen "Ellipse 4" und "Rechteck 5" in myDocument festgelegt.
Dim arShapes() As Variant Dim objRange As Object Set myDocument = Worksheets(1) arShapes = Array("Oval 4", "Rectangle 5") Set objRange = myDocument.Shapes.Range(arShapes) objRange.Fill.Patterned msoPatternHorizontalBrick
In diesem Beispiel wird das Füllmuster für die erste Form in myDocument festgelegt.
Set myDocument = Worksheets(1) Set myRange = myDocument.Shapes.Range(1) myRange.Fill.Patterned msoPatternHorizontalBrick
In diesem Beispiel wird eine Matrix erstellt, die alle AutoFormen in myDocument enthält. Mit der Matrix wird ein Formbereich definiert, anschließend werden alle Formen dieses Bereichs horizontal verteilt.
Set myDocument = Worksheets(1) With myDocument.Shapes numShapes = .Count If numShapes > 1 Then numAutoShapes = 1 ReDim autoShpArray(1 To numShapes) For i = 1 To numShapes If .Item(i).Type = msoAutoShape Then autoShpArray(numAutoShapes) = .Item(i).Name numAutoShapes = numAutoShapes + 1 End If Next If numAutoShapes > 1 Then ReDim Preserve autoShpArray(1 To numAutoShapes) Set asRange = .Range(autoShpArray) asRange.Distribute msoDistributeHorizontally, False End If End If End With