add shape ne fonctionne pas
bonjour a tous
la ligne en rouge me genere une erreur variable non definie
pourtant en mode debugage quand je pointe la souris sur la variable elle est bien definie
la variable "forme " prend le tag d'un bouton de ma command bar...ca ca fonctionne
quelqu'un aurais une idéee
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
|
Sub enleve()
Dim ShapeObj As Shape
For Each ShapeObj In Sheets(2).Shapes
If ShapeObj.Name <> "CommandButton1" Then
ShapeObj.Delete
End If
Next ShapeObj
End Sub
Sub particule()
enleve
forme = CommandBars.ActionControl.Tag
Dim couleur As Long
hauteur = Sheets("enveloppe").Range("a20").Top
largeur = Sheets("enveloppe").Range("j1").Left
'"""""""""""""""""""""""""""""""""""""""""
'1 ere partie
For j = 1 To 100
texture = Int((24 * Rnd)) + 1 'il ya 24 texture disponible
couleurbleu = Int((255 * Rnd))
couleurrouge = Int((255 * Rnd))
couleurverte = Int((255 * Rnd))
taille = Int((15 * Rnd))
If taille < 6 Then taille = 6
Randomize
DoEvents
haut = Int((hauteur * Rnd)) + 1
larg = Int((largeur * Rnd)) + 1
With Sheets("enveloppe").Shapes
.AddShape(forme, larg, haut, taille, taille).Name = "etoile" & jWith Sheets("enveloppe").Shapes("etoile" & j)
.Line.Visible = msoFalse
.Fill.Visible = msoTrue
.Fill.ForeColor.RGB = couleurbleu & couleurrouge & couleurverte
.Fill.OneColorGradient msoGradientHorizontal, 1, 0.39
End With
End With
Next
For Each ShapeObj In Sheets(2).Shapes
If Left(ShapeObj.Name, 6) = "etoile" Then
i = Right(ShapeObj.Name, 1)
If ShapeObj.Top > [h9].Top And ShapeObj.Left > [h10].Left And ShapeObj.Top < [h15].Top Then
ShapeObj.Delete
End If
End If
suite:
Next ShapeObj
End Sub |
merci pour le coup de main
au plaisir