Private Declare Sub keybd_event Lib "user32" ( _
ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, _
ByVal dwExtraInfo As Long)
Sub CreerImage()
Dim tablo(), mdp(), i As Byte
ThisWorkbook.Save 'enregistre le fichier
tablo = Array("Feuil1", "Feuil2", "Feuil3", "Feuil4")
mdp = Array("aa", "bb", "cc", "dd") 'inutile si un seul mot de passe
For i = 0 To UBound(tablo) 'sur chaque feuille du tableau
Sheets(tablo(i)).Activate
ActiveSheet.Unprotect mdp(i) 'ôte la protection de la feuille
[COLOR="Red"]Application.Goto Range("A1:M52"), True 'éventuellement : Application.Goto [COLOR="Blue"]ActiveSheet.UsedRange[/COLOR], True
ActiveWindow.Zoom = True
ActiveCell.Select[/COLOR]
Application.ScreenUpdating = True
keybd_event vbKeySnapshot, 1, 0, 0
DoEvents
Application.ScreenUpdating = False
Range("A1").Select
ActiveSheet.Paste
[COLOR="Red"]ActiveWindow.Zoom = 100[/COLOR]
Call FichierJPEG(Selection, ActiveSheet.Name)
Next
Application.OnTime Now, "Ouvre" 'permet de rouvrir le fichier
ThisWorkbook.Close False 'ferme le fichier sans enregistrer les modifications
End Sub
Sub FichierJPEG(ob As Object, feuil As String)
Dim nb As Byte
ob.CopyPicture
With ActiveSheet.ChartObjects.Add(0, 0, ob.Width, ob.Height).Chart
.Paste
.Export ThisWorkbook.Path & "\" & feuil & ".jpg", "JPG"
End With
nb = ActiveSheet.ChartObjects.Count
ActiveSheet.ChartObjects(nb).Delete
ob.Delete
End Sub
Sub Ouvre()
End Sub