V
violaine
Guest
bonjour le forum
j ai toujours le meme probleme
je n arrive pas a affecter une macro a un command button qui se trouve dans une userform
en fait j'ai crée ma macro qui fonctionne
au lieu d affecter ma macro a un bouton present dans une feuille excel je souhaite l'affecter a un bouton qui se trouve dans une userform
lorsque s'execute ma macro seule elle me place l'image au bonne endroit mais qd je l'affecte a mon bouton elle ne me met pas l'image dans la bonne feuille
voici ma macro seule:
Sub essaidessin()
'
' essaidessin Macro
' Macro enregistrée le 06/04/2005 par Valeo
'
Dim Val1
Val1 = Sheets('feuille outillage').[H2].Value
Dim val2 As String
val2 = 'F:\\UAP Mécanismes\\Usinage\\VIOLAINE\\USINAGE\\base de donnees fo\\BASE FO\\photo pour essai\\'
Dim val3 As String
val3 = val2 & Val1 & '.jpg'
Range('S8').Select
On Error GoTo erreur
ActiveSheet.Pictures.Insert(val3) _
.Select
Selection.ShapeRange.IncrementLeft -25.5
Selection.ShapeRange.IncrementTop -59.25
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 10
Selection.ShapeRange.Width = 483.75
Selection.ShapeRange.Rotation = 0#
Selection.ShapeRange.IncrementLeft 15#
Selection.ShapeRange.IncrementTop -7.5
Selection.ShapeRange.IncrementLeft 10
Selection.ShapeRange.IncrementTop 6#
GoTo Fin
erreur:
MsgBox ' IMAGE FRICTION INCONNUE. Vérifier si la photo ('référence dans la cellule B3'.jpg) est dans le répertoire : G:\\Process\\conditionnement\\PHOTOS\\kit\\ '
Fin:
Exit Sub
'
End Sub
voici avec le bouton
Private Sub CommandButton2_Click()
'Sheets('feuille outillage').Range('H2').Value = TextBox1.Value
Dim Val1
Val1 = Sheets('feuille outillage').[H2].Value
Dim val2 As String
val2 = 'F:\\UAP Mécanismes\\Usinage\\VIOLAINE\\USINAGE\\base de donnees fo\\BASE FO\\photo pour essai\\'
Dim val3 As String
val3 = val2 & Val1 & '.jpg'
Range('S8').Select
On Error GoTo erreur
ActiveSheet.Pictures.Insert(val3) _
.Select
Selection.ShapeRange.IncrementLeft -25.5
Selection.ShapeRange.IncrementTop -59.25
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 10
Selection.ShapeRange.Width = 483.75
Selection.ShapeRange.Rotation = 0#
Selection.ShapeRange.IncrementLeft 15#
Selection.ShapeRange.IncrementTop -7.5
Selection.ShapeRange.IncrementLeft 10
Selection.ShapeRange.IncrementTop 6#
GoTo Fin
erreur:
MsgBox ' IMAGE FRICTION INCONNUE. Vérifier si la photo ('référence dans la cellule B3'.jpg) est dans le répertoire : G:\\Process\\conditionnement\\PHOTOS\\kit\\ '
Fin:
Exit Sub
'End
End Sub
merci pour votre aide
j ai toujours le meme probleme
je n arrive pas a affecter une macro a un command button qui se trouve dans une userform
en fait j'ai crée ma macro qui fonctionne
au lieu d affecter ma macro a un bouton present dans une feuille excel je souhaite l'affecter a un bouton qui se trouve dans une userform
lorsque s'execute ma macro seule elle me place l'image au bonne endroit mais qd je l'affecte a mon bouton elle ne me met pas l'image dans la bonne feuille
voici ma macro seule:
Sub essaidessin()
'
' essaidessin Macro
' Macro enregistrée le 06/04/2005 par Valeo
'
Dim Val1
Val1 = Sheets('feuille outillage').[H2].Value
Dim val2 As String
val2 = 'F:\\UAP Mécanismes\\Usinage\\VIOLAINE\\USINAGE\\base de donnees fo\\BASE FO\\photo pour essai\\'
Dim val3 As String
val3 = val2 & Val1 & '.jpg'
Range('S8').Select
On Error GoTo erreur
ActiveSheet.Pictures.Insert(val3) _
.Select
Selection.ShapeRange.IncrementLeft -25.5
Selection.ShapeRange.IncrementTop -59.25
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 10
Selection.ShapeRange.Width = 483.75
Selection.ShapeRange.Rotation = 0#
Selection.ShapeRange.IncrementLeft 15#
Selection.ShapeRange.IncrementTop -7.5
Selection.ShapeRange.IncrementLeft 10
Selection.ShapeRange.IncrementTop 6#
GoTo Fin
erreur:
MsgBox ' IMAGE FRICTION INCONNUE. Vérifier si la photo ('référence dans la cellule B3'.jpg) est dans le répertoire : G:\\Process\\conditionnement\\PHOTOS\\kit\\ '
Fin:
Exit Sub
'
End Sub
voici avec le bouton
Private Sub CommandButton2_Click()
'Sheets('feuille outillage').Range('H2').Value = TextBox1.Value
Dim Val1
Val1 = Sheets('feuille outillage').[H2].Value
Dim val2 As String
val2 = 'F:\\UAP Mécanismes\\Usinage\\VIOLAINE\\USINAGE\\base de donnees fo\\BASE FO\\photo pour essai\\'
Dim val3 As String
val3 = val2 & Val1 & '.jpg'
Range('S8').Select
On Error GoTo erreur
ActiveSheet.Pictures.Insert(val3) _
.Select
Selection.ShapeRange.IncrementLeft -25.5
Selection.ShapeRange.IncrementTop -59.25
Selection.ShapeRange.LockAspectRatio = msoTrue
Selection.ShapeRange.Height = 10
Selection.ShapeRange.Width = 483.75
Selection.ShapeRange.Rotation = 0#
Selection.ShapeRange.IncrementLeft 15#
Selection.ShapeRange.IncrementTop -7.5
Selection.ShapeRange.IncrementLeft 10
Selection.ShapeRange.IncrementTop 6#
GoTo Fin
erreur:
MsgBox ' IMAGE FRICTION INCONNUE. Vérifier si la photo ('référence dans la cellule B3'.jpg) est dans le répertoire : G:\\Process\\conditionnement\\PHOTOS\\kit\\ '
Fin:
Exit Sub
'End
End Sub
merci pour votre aide