Comment peut on ouvrir un fichier image et l'intégré dans exel.
voici le chemin que je dois prendre pour aller chercher l'image:
C:\D-calc\INTEX\Devis\D0001.AFF\141_very_big.bmp
dans le tableu 141 correspond a l'image que exel va devoir prendre
et D0001 dans le fichier que l'image se situe
Alors, déjà : une chose étrange, Range est un mot clé de vb donc, normalement, l'éditeur met une majuscule. Ensuite, la procédure InsertImage doit être dans un module standard. Pour la cellule E11, tu devrais passer par un Select Case Mais entre nous, si tu affiche le même message, pas besoin de tester la valeur, si elle change affiche le message, point
GARAULT avait soumis l'idée :
Private Sub Worksheet_Change(ByVal Target As range)
If Not Intersect(Target, range("C10")) Is Nothing Then InsertImage End If
If Not Intersect(Target, range("D11")) Is Nothing Then If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner une option dans la colonne suivante." End If
If Not Intersect(Target, range("e11")) Is Nothing Then msg1 = "Attention. Penssez à selectionner un élément de la colonne suivante afin de compléter entièrement votre châssis." Select Case Target Case = "1 OF 1 vt" : MsgBox msg1 Case = "2 OF 1 vt" : MsgBox msg1 Case = "3 OF 1 vt" : MsgBox msg1 Case = "4 OF 1 vt" : MsgBoxmsg1 Case = "5 OF 1 vt" : MsgBox msg1 Case = "6 OF 1 vt" : MsgBox msg1 Case = "1 Soufflet" : MsgBox msg1 Case = "2 Soufflets" : MsgBox msg1 Case = "3 Soufflets" : MsgBox msg1 Case = "4 Soufflets" : MsgBox msg1 Case = "5 Soufflets" : MsgBox msg1 Case = "6 Soufflets" : MsgBox msg1 Case = "1 OF 2 vtx" : MsgBox msg1 Case = "2 OF 2 vtx" : MsgBox msg1 Case = "3 OF 2 vtx" : MsgBox msg1 Case = "4 OF 2 vtx" : MsgBox msg1 Case = "5 OF 2 vtx" : MsgBox msg1 Case = "6 OF 2 vtx" : MsgBox msg1 Case = "1 OF 3 vtx" : MsgBox msg1 Case = "2 OF 3 vtx" : MsgBox msg1 Case = "3 OF 3 vtx" : MsgBox msg1 Case = "4 OF 3 vtx" : MsgBox msg1 Case = "5 OF 3 vtx" : MsgBox msg1 Case = "6 OF 3 vtx" : MsgBox msg1 Case = "1 OF 4 vtx" : MsgBox msg1 Case = "2 OF 4 vtx" : MsgBox msg1 Case = "3 OF 4 vtx" : MsgBox msg1 Case = "4 OF 4 vtx" : MsgBox msg1 Case = "5 OF 4 vtx" : MsgBox msg1 Case = "6 OF 4 vtx" : MsgBox msg1 Case = "1 OF 5 vtx" : MsgBox msg1 Case = "2 OF 5 vtx" : MsgBox msg1 Case = "3 OF 5 vtx" : MsgBox msg1 Case = "4 OF 5 vtx" : MsgBox msg1 Case = "5 OF 5 vtx" : MsgBox msg1 Case = "6 OF 5 vtx" : MsgBox msg1 Case = "1 OF 6 vtx" : MsgBox msg1 Case = "2 OF 6 vtx" : MsgBox msg1 Case = "3 OF 6 vtx" : MsgBox msg1 Case = "4 OF 6 vtx" : MsgBox msg1 Case = "5 OF 6 vtx" : MsgBox msg1 Case = "6 OF 6 vtx" : MsgBox msg1 Case = "1 O Italienne" : MsgBox msg1 Case = "2 O Italienne" : MsgBox msg1 Case = "3 O Italienne" : MsgBox msg1 Case = "4 O Italienne" : MsgBox msg1 Case = "5 O Italienne" : MsgBox msg1 Case = "6 O Italienne" : MsgBox msg1 Case = "1 POF 1vt" : MsgBox msg1 Case = "2 POF 1vt" : MsgBox msg1 Case = "3 POF 1vt" : MsgBox msg1 Case = "4 POF 1vt" : MsgBox msg1 Case = "5 POF 1vt" : MsgBox msg1 Case = "6 POF 1vt" : MsgBox msg1 Case = "1 POF 2 vtx" : MsgBox msg1 Case = "2 POF 2 vtx" : MsgBox msg1 Case = "3 POF 2 vtx" : MsgBox msg1 Case = "4 POF 2 vtx" : MsgBox msg1 Case = "5 POF 2 vtx" : MsgBox msg1 Case = "6 POF 2 vtx" : MsgBox msg1 Case = "1 POE 1vt" : MsgBox msg1 Case = "2 POE 1vt" : MsgBox msg1 Case = "3 POE 1vt" : MsgBox msg1 Case = "4 POE 1vt" : MsgBox msg1 Case = "5 POE 1vt" : MsgBox msg1 Case = "6 POE 1vt" : MsgBox msg1 Case = "1 POE 2 vtx" : MsgBox msg1 Case = "2 POE 2 vtx" : MsgBox msg1 Case = "3 POE 2 vtx" : MsgBox msg1 Case = "4 POE 2 vtx" : MsgBox msg1 Case = "5 POE 2 vtx" : MsgBox msg1 Case = "6 POE 2 vtx" : MsgBox msg1 Case = "1 P va et vient 1 vt" : MsgBox msg1 Case = "2 P va et vient 1 vt" : MsgBox msg1 Case = "3 P va et vient 1 vt" : MsgBox msg1 Case = "4 P va et vient 1 vt" : MsgBox msg1 Case = "5 P va et vient 1 vt" : MsgBox msg1 Case = "6 P va et vient 1 vt" : MsgBox msg1 Case = "1 P va et vient 2 vtx" : MsgBox msg1 Case = "2 P va et vient 2 vtx" : MsgBox msg1 Case = "3 P va et vient 2 vtx" : MsgBox msg1 Case = "4 P va et vient 2 vtx" : MsgBox msg1 Case = "5 P va et vient 2 vtx" : MsgBox msg1 Case = "6 P va et vient 2 vtx" : MsgBox msg1 Case = "1 Châssis fixe" : MsgBox msg1 Case = "2 Châssis fixe" : MsgBox msg1 Case = "3 Châssis fixe" : MsgBox msg1 Case = "4 Châssis fixe" : MsgBox msg1 Case = "5 Châssis fixe" : MsgBox msg1 Case = "6 Châssis fixe" : MsgBox msg1 End Select End If
End Sub
'************ MODULE STANDARD ***************
Sub InsertImage() ' 'Les cellules G12 à H15 sont fusionnées ' On Error Resume Next 'Pour le cas où il n'y a pas d'image ActiveSheet.Shapes("MonImage").Delete range("G12").Select ActiveSheet.Pictures.Insert(range("s5")).Select With Selection.ShapeRange .LockAspectRatio = msoTrue 'Garde les proportions .Height = 100# 'Pour donner à peu près la hauteur de la cellule .Name = "MonImage" 'Donne un nom à l'image End With range("c10").Select End Sub
-- JLuc
lien: http://cjoint.com/?kFh4Dz5URv
Alors, déjà : une chose étrange, Range est un mot clé de vb donc,
normalement, l'éditeur met une majuscule.
Ensuite, la procédure InsertImage doit être dans un module standard.
Pour la cellule E11, tu devrais passer par un Select Case
Mais entre nous, si tu affiche le même message, pas besoin de tester la
valeur, si elle change affiche le message, point
GARAULT avait soumis l'idée :
Private Sub Worksheet_Change(ByVal Target As range)
If Not Intersect(Target, range("C10")) Is Nothing Then
InsertImage
End If
If Not Intersect(Target, range("D11")) Is Nothing Then
If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à
sélectionner une option dans la colonne suivante."
End If
If Not Intersect(Target, range("e11")) Is Nothing Then
msg1 = "Attention. Penssez à selectionner un élément de la colonne
suivante afin de compléter entièrement votre châssis."
Select Case Target
Case = "1 OF 1 vt" : MsgBox msg1
Case = "2 OF 1 vt" : MsgBox msg1
Case = "3 OF 1 vt" : MsgBox msg1
Case = "4 OF 1 vt" : MsgBoxmsg1
Case = "5 OF 1 vt" : MsgBox msg1
Case = "6 OF 1 vt" : MsgBox msg1
Case = "1 Soufflet" : MsgBox msg1
Case = "2 Soufflets" : MsgBox msg1
Case = "3 Soufflets" : MsgBox msg1
Case = "4 Soufflets" : MsgBox msg1
Case = "5 Soufflets" : MsgBox msg1
Case = "6 Soufflets" : MsgBox msg1
Case = "1 OF 2 vtx" : MsgBox msg1
Case = "2 OF 2 vtx" : MsgBox msg1
Case = "3 OF 2 vtx" : MsgBox msg1
Case = "4 OF 2 vtx" : MsgBox msg1
Case = "5 OF 2 vtx" : MsgBox msg1
Case = "6 OF 2 vtx" : MsgBox msg1
Case = "1 OF 3 vtx" : MsgBox msg1
Case = "2 OF 3 vtx" : MsgBox msg1
Case = "3 OF 3 vtx" : MsgBox msg1
Case = "4 OF 3 vtx" : MsgBox msg1
Case = "5 OF 3 vtx" : MsgBox msg1
Case = "6 OF 3 vtx" : MsgBox msg1
Case = "1 OF 4 vtx" : MsgBox msg1
Case = "2 OF 4 vtx" : MsgBox msg1
Case = "3 OF 4 vtx" : MsgBox msg1
Case = "4 OF 4 vtx" : MsgBox msg1
Case = "5 OF 4 vtx" : MsgBox msg1
Case = "6 OF 4 vtx" : MsgBox msg1
Case = "1 OF 5 vtx" : MsgBox msg1
Case = "2 OF 5 vtx" : MsgBox msg1
Case = "3 OF 5 vtx" : MsgBox msg1
Case = "4 OF 5 vtx" : MsgBox msg1
Case = "5 OF 5 vtx" : MsgBox msg1
Case = "6 OF 5 vtx" : MsgBox msg1
Case = "1 OF 6 vtx" : MsgBox msg1
Case = "2 OF 6 vtx" : MsgBox msg1
Case = "3 OF 6 vtx" : MsgBox msg1
Case = "4 OF 6 vtx" : MsgBox msg1
Case = "5 OF 6 vtx" : MsgBox msg1
Case = "6 OF 6 vtx" : MsgBox msg1
Case = "1 O Italienne" : MsgBox msg1
Case = "2 O Italienne" : MsgBox msg1
Case = "3 O Italienne" : MsgBox msg1
Case = "4 O Italienne" : MsgBox msg1
Case = "5 O Italienne" : MsgBox msg1
Case = "6 O Italienne" : MsgBox msg1
Case = "1 POF 1vt" : MsgBox msg1
Case = "2 POF 1vt" : MsgBox msg1
Case = "3 POF 1vt" : MsgBox msg1
Case = "4 POF 1vt" : MsgBox msg1
Case = "5 POF 1vt" : MsgBox msg1
Case = "6 POF 1vt" : MsgBox msg1
Case = "1 POF 2 vtx" : MsgBox msg1
Case = "2 POF 2 vtx" : MsgBox msg1
Case = "3 POF 2 vtx" : MsgBox msg1
Case = "4 POF 2 vtx" : MsgBox msg1
Case = "5 POF 2 vtx" : MsgBox msg1
Case = "6 POF 2 vtx" : MsgBox msg1
Case = "1 POE 1vt" : MsgBox msg1
Case = "2 POE 1vt" : MsgBox msg1
Case = "3 POE 1vt" : MsgBox msg1
Case = "4 POE 1vt" : MsgBox msg1
Case = "5 POE 1vt" : MsgBox msg1
Case = "6 POE 1vt" : MsgBox msg1
Case = "1 POE 2 vtx" : MsgBox msg1
Case = "2 POE 2 vtx" : MsgBox msg1
Case = "3 POE 2 vtx" : MsgBox msg1
Case = "4 POE 2 vtx" : MsgBox msg1
Case = "5 POE 2 vtx" : MsgBox msg1
Case = "6 POE 2 vtx" : MsgBox msg1
Case = "1 P va et vient 1 vt" : MsgBox msg1
Case = "2 P va et vient 1 vt" : MsgBox msg1
Case = "3 P va et vient 1 vt" : MsgBox msg1
Case = "4 P va et vient 1 vt" : MsgBox msg1
Case = "5 P va et vient 1 vt" : MsgBox msg1
Case = "6 P va et vient 1 vt" : MsgBox msg1
Case = "1 P va et vient 2 vtx" : MsgBox msg1
Case = "2 P va et vient 2 vtx" : MsgBox msg1
Case = "3 P va et vient 2 vtx" : MsgBox msg1
Case = "4 P va et vient 2 vtx" : MsgBox msg1
Case = "5 P va et vient 2 vtx" : MsgBox msg1
Case = "6 P va et vient 2 vtx" : MsgBox msg1
Case = "1 Châssis fixe" : MsgBox msg1
Case = "2 Châssis fixe" : MsgBox msg1
Case = "3 Châssis fixe" : MsgBox msg1
Case = "4 Châssis fixe" : MsgBox msg1
Case = "5 Châssis fixe" : MsgBox msg1
Case = "6 Châssis fixe" : MsgBox msg1
End Select
End If
End Sub
'************ MODULE STANDARD ***************
Sub InsertImage()
'
'Les cellules G12 à H15 sont fusionnées
'
On Error Resume Next 'Pour le cas où il n'y a pas d'image
ActiveSheet.Shapes("MonImage").Delete
range("G12").Select
ActiveSheet.Pictures.Insert(range("s5")).Select
With Selection.ShapeRange
.LockAspectRatio = msoTrue 'Garde les proportions
.Height = 100# 'Pour donner à peu près la hauteur de la cellule
.Name = "MonImage" 'Donne un nom à l'image
End With
range("c10").Select
End Sub
Alors, déjà : une chose étrange, Range est un mot clé de vb donc, normalement, l'éditeur met une majuscule. Ensuite, la procédure InsertImage doit être dans un module standard. Pour la cellule E11, tu devrais passer par un Select Case Mais entre nous, si tu affiche le même message, pas besoin de tester la valeur, si elle change affiche le message, point
GARAULT avait soumis l'idée :
Private Sub Worksheet_Change(ByVal Target As range)
If Not Intersect(Target, range("C10")) Is Nothing Then InsertImage End If
If Not Intersect(Target, range("D11")) Is Nothing Then If [d11] = "Ens." Then MsgBox "Attention cela vous oblige à sélectionner une option dans la colonne suivante." End If
If Not Intersect(Target, range("e11")) Is Nothing Then msg1 = "Attention. Penssez à selectionner un élément de la colonne suivante afin de compléter entièrement votre châssis." Select Case Target Case = "1 OF 1 vt" : MsgBox msg1 Case = "2 OF 1 vt" : MsgBox msg1 Case = "3 OF 1 vt" : MsgBox msg1 Case = "4 OF 1 vt" : MsgBoxmsg1 Case = "5 OF 1 vt" : MsgBox msg1 Case = "6 OF 1 vt" : MsgBox msg1 Case = "1 Soufflet" : MsgBox msg1 Case = "2 Soufflets" : MsgBox msg1 Case = "3 Soufflets" : MsgBox msg1 Case = "4 Soufflets" : MsgBox msg1 Case = "5 Soufflets" : MsgBox msg1 Case = "6 Soufflets" : MsgBox msg1 Case = "1 OF 2 vtx" : MsgBox msg1 Case = "2 OF 2 vtx" : MsgBox msg1 Case = "3 OF 2 vtx" : MsgBox msg1 Case = "4 OF 2 vtx" : MsgBox msg1 Case = "5 OF 2 vtx" : MsgBox msg1 Case = "6 OF 2 vtx" : MsgBox msg1 Case = "1 OF 3 vtx" : MsgBox msg1 Case = "2 OF 3 vtx" : MsgBox msg1 Case = "3 OF 3 vtx" : MsgBox msg1 Case = "4 OF 3 vtx" : MsgBox msg1 Case = "5 OF 3 vtx" : MsgBox msg1 Case = "6 OF 3 vtx" : MsgBox msg1 Case = "1 OF 4 vtx" : MsgBox msg1 Case = "2 OF 4 vtx" : MsgBox msg1 Case = "3 OF 4 vtx" : MsgBox msg1 Case = "4 OF 4 vtx" : MsgBox msg1 Case = "5 OF 4 vtx" : MsgBox msg1 Case = "6 OF 4 vtx" : MsgBox msg1 Case = "1 OF 5 vtx" : MsgBox msg1 Case = "2 OF 5 vtx" : MsgBox msg1 Case = "3 OF 5 vtx" : MsgBox msg1 Case = "4 OF 5 vtx" : MsgBox msg1 Case = "5 OF 5 vtx" : MsgBox msg1 Case = "6 OF 5 vtx" : MsgBox msg1 Case = "1 OF 6 vtx" : MsgBox msg1 Case = "2 OF 6 vtx" : MsgBox msg1 Case = "3 OF 6 vtx" : MsgBox msg1 Case = "4 OF 6 vtx" : MsgBox msg1 Case = "5 OF 6 vtx" : MsgBox msg1 Case = "6 OF 6 vtx" : MsgBox msg1 Case = "1 O Italienne" : MsgBox msg1 Case = "2 O Italienne" : MsgBox msg1 Case = "3 O Italienne" : MsgBox msg1 Case = "4 O Italienne" : MsgBox msg1 Case = "5 O Italienne" : MsgBox msg1 Case = "6 O Italienne" : MsgBox msg1 Case = "1 POF 1vt" : MsgBox msg1 Case = "2 POF 1vt" : MsgBox msg1 Case = "3 POF 1vt" : MsgBox msg1 Case = "4 POF 1vt" : MsgBox msg1 Case = "5 POF 1vt" : MsgBox msg1 Case = "6 POF 1vt" : MsgBox msg1 Case = "1 POF 2 vtx" : MsgBox msg1 Case = "2 POF 2 vtx" : MsgBox msg1 Case = "3 POF 2 vtx" : MsgBox msg1 Case = "4 POF 2 vtx" : MsgBox msg1 Case = "5 POF 2 vtx" : MsgBox msg1 Case = "6 POF 2 vtx" : MsgBox msg1 Case = "1 POE 1vt" : MsgBox msg1 Case = "2 POE 1vt" : MsgBox msg1 Case = "3 POE 1vt" : MsgBox msg1 Case = "4 POE 1vt" : MsgBox msg1 Case = "5 POE 1vt" : MsgBox msg1 Case = "6 POE 1vt" : MsgBox msg1 Case = "1 POE 2 vtx" : MsgBox msg1 Case = "2 POE 2 vtx" : MsgBox msg1 Case = "3 POE 2 vtx" : MsgBox msg1 Case = "4 POE 2 vtx" : MsgBox msg1 Case = "5 POE 2 vtx" : MsgBox msg1 Case = "6 POE 2 vtx" : MsgBox msg1 Case = "1 P va et vient 1 vt" : MsgBox msg1 Case = "2 P va et vient 1 vt" : MsgBox msg1 Case = "3 P va et vient 1 vt" : MsgBox msg1 Case = "4 P va et vient 1 vt" : MsgBox msg1 Case = "5 P va et vient 1 vt" : MsgBox msg1 Case = "6 P va et vient 1 vt" : MsgBox msg1 Case = "1 P va et vient 2 vtx" : MsgBox msg1 Case = "2 P va et vient 2 vtx" : MsgBox msg1 Case = "3 P va et vient 2 vtx" : MsgBox msg1 Case = "4 P va et vient 2 vtx" : MsgBox msg1 Case = "5 P va et vient 2 vtx" : MsgBox msg1 Case = "6 P va et vient 2 vtx" : MsgBox msg1 Case = "1 Châssis fixe" : MsgBox msg1 Case = "2 Châssis fixe" : MsgBox msg1 Case = "3 Châssis fixe" : MsgBox msg1 Case = "4 Châssis fixe" : MsgBox msg1 Case = "5 Châssis fixe" : MsgBox msg1 Case = "6 Châssis fixe" : MsgBox msg1 End Select End If
End Sub
'************ MODULE STANDARD ***************
Sub InsertImage() ' 'Les cellules G12 à H15 sont fusionnées ' On Error Resume Next 'Pour le cas où il n'y a pas d'image ActiveSheet.Shapes("MonImage").Delete range("G12").Select ActiveSheet.Pictures.Insert(range("s5")).Select With Selection.ShapeRange .LockAspectRatio = msoTrue 'Garde les proportions .Height = 100# 'Pour donner à peu près la hauteur de la cellule .Name = "MonImage" 'Donne un nom à l'image End With range("c10").Select End Sub
-- JLuc
JLuc
Il faudrait l'appli complete avec tous les fichiers en zip. Comme ça, j'ai des erreurs que je ne peux pas gerer (n'ayant pas les fichiers liés)
-- JLuc
Il faudrait l'appli complete avec tous les fichiers en zip.
Comme ça, j'ai des erreurs que je ne peux pas gerer (n'ayant pas les
fichiers liés)