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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197
|
Function presentation_pdf(nom_rapport, semaine)
Dim PPTApp As PowerPoint.Application
Dim PPTDoc As PowerPoint.presentation
Dim Sh As PowerPoint.Shape
Dim oDataObject As DataObject
Dim Diapo As PowerPoint.Slide
Dim NbShpe As Integer
'Permet de créer un powerpoint
Set PPTApp = CreateObject("Powerpoint.Application")
Set PPTDoc = PPTApp.Presentations.Add
Sheets(nom_rapport).Select
With PPTDoc
...
...
...
'--- Ajoute un nouveau slide et le positionne en 3eme position
Set Diapo = .Slides.Add(Index:=3, Layout:=ppLayoutBlank)
.Slides(3).Select
'Crée une zone de texte pour "Contacts"
Set Sh = .Slides(3).Shapes.AddLabel(Orientation:=msoTextOrientationHorizontal, _
Left:=221, Top:=0, Width:=304, Height:=39)
With Sh.TextFrame.TextRange
.Text = "Contacts"
.Font.Color = RGB(31, 73, 125)
.Font.Bold = msoTrue
.Font.Size = 26
End With
'Crée une zone de texte pour "Activité hebdo"
Set Sh = .Slides(3).Shapes.AddLabel(Orientation:=msoTextOrientationHorizontal, _
Left:=89, Top:=59, Width:=8169, Height:=29)
With Sh.TextFrame.TextRange
.Text = "Activité hebdo"
.Font.Color = RGB(31, 73, 125)
.Font.Underline = msoTrue
.Font.Size = 18
End With
'Crée une zone de texte pour "Tendances"
Set Sh = .Slides(3).Shapes.AddLabel(Orientation:=msoTextOrientationHorizontal, _
Left:=133, Top:=400, Width:=92, Height:=29)
With Sh.TextFrame.TextRange
.Text = "Tendances"
.Font.Color = RGB(31, 73, 125)
.Font.Underline = msoTrue
.Font.Size = 18
End With
'Crée une zone de texte pour "% Contacts"
Set Sh = .Slides(3).Shapes.AddLabel(Orientation:=msoTextOrientationHorizontal, _
Left:=400, Top:=400, Width:=92, Height:=29)
With Sh.TextFrame.TextRange
.Text = " % Contacts"
.Font.Color = RGB(31, 73, 125)
.Font.Underline = msoTrue
.Font.Size = 18
End With
'Crée une zone de texte pour "Structure de notre activité"
Set Sh = .Slides(3).Shapes.AddLabel(Orientation:=msoTextOrientationHorizontal, _
Left:=390, Top:=59, Width:=252, Height:=29)
With Sh.TextFrame.TextRange
.Text = "Structure de notre activité"
.Font.Color = RGB(31, 73, 125)
.Font.Underline = msoTrue
.Font.Size = 18
End With
' 'Crée une zone de texte pour commentaire
' Set Sh = .Slides(3).Shapes.AddTextbox(msoTextOrientationHorizontal, _
' Left:=30, Top:=430, Width:=333, Height:=95)
' With Sh.Fill
' .Visible = msoTrue
' .ForeColor.ObjectThemeColor = msoThemeColorAccent1
' End With
'Crée une zone de texte pour "Les valeurs dans le radar sont plafonnées à 130%"
Set Sh = .Slides(3).Shapes.AddLabel(Orientation:=msoTextOrientationHorizontal, _
Left:=444, Top:=380, Width:=157, Height:=16)
With Sh.TextFrame.TextRange
.Text = "Les valeurs dans le radar sont plafonnées à 130%"
.Font.Color = RGB(31, 73, 125)
.Font.Bold = msoTrue
.Font.Size = 7
End With
'Crée une zone de texte pour "* En pourcentage"
Set Sh = .Slides(3).Shapes.AddLabel(Orientation:=msoTextOrientationHorizontal, _
Left:=146, Top:=500, Width:=65, Height:=16)
With Sh.TextFrame.TextRange
.Text = "* En pourcentage"
.Font.Color = RGB(31, 73, 125)
.Font.Bold = msoTrue
.Font.Size = 7
End With
'Copie le graphique nommé "Graphique_Contact_" & nom_rapport dans la feuille
Sheets(nom_rapport).ChartObjects("Graphique_Contact_" & nom_rapport).Activate
Sheets(nom_rapport).ChartObjects("Graphique_Contact_" & nom_rapport).Copy
'On le colle dans la 2eme diapositive
Diapo.Shapes.Paste
NbShpe = Diapo.Shapes.Count
'Renomme et met en forme l'objet collé
With Diapo.Shapes(NbShpe)
.Name = "Graphique_Contact" 'personnalise le nom
.Left = 20 'définit la position horizontale dans le slide
.Top = 87 'définit la position verticale dans le slide
.Height = 179 'hauteur
.Width = 319 'largeur
End With
'Ajoute le tableau de tendances dans la feuille
Sheets(nom_rapport).Range("L3:M6").Copy
Diapo.Shapes.PasteSpecial ppPasteEnhancedMetafile
NbShpe = Diapo.Shapes.Count
'Renomme et met en forme l'objet collé
With Diapo.Shapes(NbShpe)
.Name = "Tab_Contact" 'personnalise le nom
.Left = 59 'définit la position horizontale dans le slide
.Top = 429 'définit la position verticale dans le slide
.Height = 77 'hauteur
.Width = 242 'largeur
End With
'Ajoute le tableau de contact avec motifs dans la feuille
Sheets(nom_rapport).Range("p17:Q19").Copy
Diapo.Shapes.PasteSpecial ppPasteEnhancedMetafile
NbShpe = Diapo.Shapes.Count
'Renomme et met en forme l'objet collé
With Diapo.Shapes(NbShpe)
.Name = "Tab_Contact" 'personnalise le nom
.Left = 400 'définit la position horizontale dans le slide
.Top = 429 'définit la position verticale dans le slide
.Height = 77 'hauteur
.Width = 242 'largeur
End With
'Copie le graphique nommé "Radar_Contact" dans la feuille
Sheets(nom_rapport).ChartObjects("Radar_Contact").Activate
Sheets(nom_rapport).ChartObjects("Radar_Contact").Copy
'On le colle dans la 2eme diapositive
Diapo.Shapes.PasteSpecial
NbShpe = Diapo.Shapes.Count
'Renomme et met en forme l'objet collé
With Diapo.Shapes(NbShpe)
.Name = "Graphique_Radar_Contact" 'personnalise le nom
.Left = 322 'définit la position horizontale dans le slide
.Top = 100 'définit la position verticale dans le slide
.Height = 282 'hauteur
.Width = 391 'largeur
End With
'Permet de tracer la 1ère ligne sous le titre
.Slides(3).Shapes.AddConnector(Type:=msoConnectorStraight, _
BeginX:=0, BeginY:=38, EndX:=710, EndY:=38).Select
'Permet de tracer la 2ème ligne sous le titre
.Slides(3).Shapes.AddConnector(Type:=msoConnectorStraight, _
BeginX:=0, BeginY:=43, EndX:=710, EndY:=43).Select
'Sauvegarde la présentation
'dans le meme répertoire que le classeur excel contenant la macro.
If Dir(ActiveWorkbook.Path & "\" & nom_rapport, vbDirectory) = "" Then
MkDir (ActiveWorkbook.Path & "\" & nom_rapport)
End If
PPTDoc.SaveAs Filename:=ActiveWorkbook.Path & "\" & nom_rapport & "\Pres_" & nom_rapport & "_sem_" & semaine & ".ppt"
'ferme la presentation
PPTDoc.Close
Set oDataObject = New DataObject
oDataObject.SetText ""
oDataObject.PutInClipboard
Set oDataObject = Nothing
'Si on est sur le dernier rapport
If nom_rapport = "12" Then
'ferme powerpoint
PPTApp.Quit
End If
End Function |
Partager