1 pièce(s) jointe(s)
Macro qui ne passe plus sous office 2013
Bonjour,
on m'avait créé une macro qui permettait la copie d'une plage Xls, et de la transformer en image jpeg.
Depuis le passage à office 2013 il y a une erreur 1004 sur LeGraph.Chart.Paste.
Je n'y connais rien en programmation, quelqu'un pourrait-il m'aider à corriger ce bug ?
Merci d'avance.
Une image de la macro est aussi en fichier joint.
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
| Sub export_hiver_jpg()
'
' export_hiver_jpg Macro
''1 Nommer les plages à sélectionner
'Par mapeh
Dim NomPlage, NomFich
Dim LeGraph As Object
Dim Rep As String
Dim i As Byte
Application.ScreenUpdating = False
Rep = "G:\sites web\locweb\images\" 'Répertoire de sauvegarde
NomPlage = Array("tarifrdcpleneyhiver", "tarifduplexnyonhiver", "tarifduplexavoriazhiver", "tarifchaletarthurhiver", "tarifchaletlenidhiver", "tarifarthursaisonhiver") 'Nom de tes plages
NomFich = Array("tarifrdcpleneyhiver", "tarifduplexnyonhiver", "tarifduplexavoriazhiver", "tarifchaletarthurhiver", "tarifnidhiver", "tarifarthursaisonhiver") 'Nom des fichiers de sortie correspondants
' "tarifrdcpleneyhiver", "tarifduplexnyonhiver", "tarifduplexavoriazhiver", "tarifchaletarthurhiver", "tarifchaletlenidhiver"
' "tarifrdcpleneyete", "tarifduplexnyonete", "tarifduplexavoriazete", "tarifchaletarthurete", "tarifchaletlenidete"
With Sheets("HIVER") 'nom de la feuille ou sont les plages
For i = LBound(NomPlage) To UBound(NomPlage)
.Range(NomPlage(i)).CopyPicture
Set LeGraph = .ChartObjects.Add(0, 0, .Range(NomPlage(i)).Width, .Range(NomPlage(i)).Height)
LeGraph.Chart.Paste
LeGraph.Chart.Export Filename:=Rep & NomFich(i) & ".jpg"
LeGraph.Delete
Next i
End With
'
End Sub |
Pièce jointe 163967