Bonjour à tous
J'ai plusieurs fichiers avec des macros que j'ai créé sous Excel 2010et ou 97 ....
Au boulot on nous changé les PC et nous sommes passé en Excel 2016...
Les macros de fonctionne plus est ce du au changement de version??
je chercher depuis plusieurs jours à régler le problème mais impossible de trouver la solution.
pourriez-vous m'aider .
Ci-dessous les deux macro principales qui ne fonctionne plus .
MACRO 1
Sub ecran()
Dim Plage As Range
Dim x As Byte
Dim Chemin As String
Dim wks As Worksheet
Chemin = ThisWorkbook.Path & "\" ' a adapter
For Each wks In ActiveWorkbook.Worksheets
If Left(wks.Name, 4) = "plat" Then
x = x + 1
Set Plage = wks.Range("A1:B7")
Application.ScreenUpdating = False
Workbooks.Add: Plage.CopyPicture: ActiveSheet.Paste
With ActiveSheet.ChartObjects.Add(0, 0, Selection.Width, Selection.Height).Chart
.Paste
.Export Chemin & wks.Cells(1, 2).Value & ".jpg", "JPG"
End With
ActiveWorkbook.Close False
End If
Next
Sheets("plats 1_2").Select
Rows("2:7").Select
Selection.RowHeight = 122.25
Sheets("Ouverture").Select
Rows("6:17").Select
Selection.RowHeight = 62.25
Range("A6").Select
ActiveWorkbook.Save
'ActiveWorkbook.Saved = True
ActiveWorkbook.Close
End Sub
MACRO 2
Sub copier_menu_et_mise_en_forme()
Workbooks.Open Filename:=ThisWorkbook.Path & "\ListeDesAllergenes.xls"
'Windows("ListeDesAllergenes.xls").Activate
'ActiveSheet.Shapes("Picture 1").Select
'Selection.Delete
Rows("1:7").Select
Range("B1").Activate
Selection.Copy
Windows("- ALLERGENES TYPE.xls").Activate
Rows("7:14").Select
Range("B7").Activate
ActiveSheet.Paste
Range("A1").Select
Windows("ListeDesAllergenes.xls").Activate
Rows("10:63").Select
Selection.Copy
Windows("- ALLERGENES TYPE.xls").Activate
Rows("17:17").Select
ActiveSheet.Paste
Selection.RowHeight = 40.5
Application.CutCopyMode = False
With Selection
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
With Selection.Font
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
End With
Range("A1").Select
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=2, Copies:=1, Collate _
:=True
ActiveSheet.Copy
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & Format(Range("I13"), "yy-mm-dd") & " " & Range("a10") & ".xls"
'ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & Range("a10") & " " & Format(Range("I13"), "yy-mm-dd") & ".xls"
Application.DisplayAlerts = False
Application.Quit
End Sub
par avance merci
J'ai plusieurs fichiers avec des macros que j'ai créé sous Excel 2010et ou 97 ....
Au boulot on nous changé les PC et nous sommes passé en Excel 2016...
Les macros de fonctionne plus est ce du au changement de version??
je chercher depuis plusieurs jours à régler le problème mais impossible de trouver la solution.
pourriez-vous m'aider .
Ci-dessous les deux macro principales qui ne fonctionne plus .
MACRO 1
Sub ecran()
Dim Plage As Range
Dim x As Byte
Dim Chemin As String
Dim wks As Worksheet
Chemin = ThisWorkbook.Path & "\" ' a adapter
For Each wks In ActiveWorkbook.Worksheets
If Left(wks.Name, 4) = "plat" Then
x = x + 1
Set Plage = wks.Range("A1:B7")
Application.ScreenUpdating = False
Workbooks.Add: Plage.CopyPicture: ActiveSheet.Paste
With ActiveSheet.ChartObjects.Add(0, 0, Selection.Width, Selection.Height).Chart
.Paste
.Export Chemin & wks.Cells(1, 2).Value & ".jpg", "JPG"
End With
ActiveWorkbook.Close False
End If
Next
Sheets("plats 1_2").Select
Rows("2:7").Select
Selection.RowHeight = 122.25
Sheets("Ouverture").Select
Rows("6:17").Select
Selection.RowHeight = 62.25
Range("A6").Select
ActiveWorkbook.Save
'ActiveWorkbook.Saved = True
ActiveWorkbook.Close
End Sub
MACRO 2
Sub copier_menu_et_mise_en_forme()
Workbooks.Open Filename:=ThisWorkbook.Path & "\ListeDesAllergenes.xls"
'Windows("ListeDesAllergenes.xls").Activate
'ActiveSheet.Shapes("Picture 1").Select
'Selection.Delete
Rows("1:7").Select
Range("B1").Activate
Selection.Copy
Windows("- ALLERGENES TYPE.xls").Activate
Rows("7:14").Select
Range("B7").Activate
ActiveSheet.Paste
Range("A1").Select
Windows("ListeDesAllergenes.xls").Activate
Rows("10:63").Select
Selection.Copy
Windows("- ALLERGENES TYPE.xls").Activate
Rows("17:17").Select
ActiveSheet.Paste
Selection.RowHeight = 40.5
Application.CutCopyMode = False
With Selection
.VerticalAlignment = xlCenter
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.ReadingOrder = xlContext
End With
With Selection.Font
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
End With
Range("A1").Select
ActiveWindow.SelectedSheets.PrintOut From:=1, To:=2, Copies:=1, Collate _
:=True
ActiveSheet.Copy
ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & Format(Range("I13"), "yy-mm-dd") & " " & Range("a10") & ".xls"
'ActiveWorkbook.SaveAs ThisWorkbook.Path & "\" & Range("a10") & " " & Format(Range("I13"), "yy-mm-dd") & ".xls"
Application.DisplayAlerts = False
Application.Quit
End Sub
par avance merci