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
| Option Explicit
Private Sub btnPrintGraph()
PoserImage "Libération PF.xlsm", "Graphique 1"
PoserImage "Libération PF.xlsm", "Graphique 2"
PoserImage "Libération PF.xlsm", "Graphique 3"
End Sub
Private Sub PoserImage(sFichier As String, sGraph As String)
Dim sChemin As String
ActiveSheet.Shapes(1).Delete '--- il faut effacer l'image précédente
sChemin = "T:\DIRECTIONCQ\PLANIF CQ\PLANNING CQ PHARMA 2019"
Application.Workbooks.Open FileName:=sChemin & "\" & sFichier, ReadOnly:=True
Workbooks(sFichier).Worksheets("Graphs").Activate
ActiveSheet.Shapes.Range(Array(sGraph, sGraph)).Select
Application.CutCopyMode = False
Selection.Copy
ThisWorkbook.Worksheets("Feuil3").Activate
Range("A1").Select
ActiveSheet.Paste
With Selection.ShapeRange
.Top = 1
.Left = 1
.Width = 400
.Height = 200
End With
ActiveSheet.PrintOut Preview:=True '--- aperçu avant impression
End Sub |
Partager