VBA-Macro combine shapes

Hi,
I'm a beginner. I was hoping someone would show me why my first macro doesn't work.

I need a macro that will:

- Find any shape with outline.width = 0.2 mm, but just for the selected objects
- Assign all located outline.width = 0.2 mm with a red color
- Combine all located outline.width = 0.2 mm 

Here is my code:
----------------------------------------------------------------
Sub dick_rot_kombi_5()
    Dim shs As Shapes, sh As Shape
    Set shs = ActiveSelection.Shapes
       
    ActiveDocument.Unit = cdrMillimeter
   
    If ActiveSelectionRange.Count = 0 Then
        MsgBox "Es ist kein Objekt ausgewählt!"
    Exit Sub
    Else
        If ActiveSelectionRange.Count = 1 Then
            MsgBox "Es ist nur 1 Objekt ausgewählt!"
    Exit Sub
        End If
            End If
       
    For Each sh In shs
        If sh.Outline.Width = 0.2 Then
        sh.Outline.Color.RGBAssign 255, 0, 0
          
        End If
                
    Next sh
   
    Set shs = sh.Combine 'here appears an error "91"Angry
       
End Sub
---------------------------------------------------------------------------------
Any help would be appreciated, thanks!Yes
Markus

P.S: sorry for my english, it's not my native language.

Parents Reply Children
No Data