VBA Application.caller error 13 run time

Bonjour,

voici mon debut de code pour une carte interactive par contre j'ai error 13 run time

Sub Freeform124_Click()
Dim NomShape As String

NomShape = Application.Caller



For Each Shape In ActiveSheet.Shapes
form.Fill.ForeColor.RGB = RGB(0, 50, 0)
Next Shape


End Sub


quelqu'un peut m'aider

2 réponses

  1. Bonjour,

    1. Ne pas employer de variable nommée avec un mot du langage (For each shape in ...)
    2. Tester le type de shape (tous n'ont pas une propriété Fill)

    Par exemple
    Sub Freeform124_Click() 
    Dim shp As Shape
      For Each shp In ActiveSheet.Shapes
        If shp.Type = msoFreeform Then
          shp.Fill.ForeColor.RGB = RGB(0, 50, 0) 
        End If
      Next shp
    End Sub 

    Cordialement
    Patrice
    1. Bonjour,

      Je n'ai pas cette erreur mais objet requis a celle-ci
      form.Fill.ForeColor.RGB = RGB(0, 50, 0)