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
| Sub c_est_parti()
On Error Resume Next
MkDir ThisWorkbook.Path & "\imgrecup"
Err.Clear
Sheets.Add After:=Sheets(Sheets.Count)
With Sheets(2).ChartObjects.Add(0, 0, 100, 100).Chart
.Parent.Name = "calque"
End With
For i = 6 To Sheets(1).Cells(Rows.Count, 2).End(xlUp).Row
If Sheets(1).Cells(i, 2).Comment.Shape.Fill.Type = 6 Then
save_comment_fichier_jpg i
End If
Next
Sheets(2).ChartObjects(Sheets(2).ChartObjects.Count).Delete
End Sub
Sub save_comment_fichier_jpg(x)
Application.ScreenUpdating = False
With Sheets(1).Cells(x, 2)
If Not .Comment Is Nothing Then
.Comment.Visible = True
.Comment.Shape.CopyPicture
With Sheets(2).ChartObjects("calque")
.Height = Sheets(1).Cells(x, 2).Comment.Shape.Height
.Width = Sheets(1).Cells(x, 2).Comment.Shape.Width
.Chart.Paste
.Chart.Export ThisWorkbook.Path & "\imgrecup\" & Sheets(1).Cells(x, 2) & ".jpg", "JPG"
End With
.Comment.Visible = False
End If
End With
Application.ScreenUpdating = True
End Sub |
Partager