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 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320
|
Function InsertPpt()
On Error GoTo StopConfig1
Dim Ppt As powerpoint.Application
Dim Pres As powerpoint.Presentation
Dim Diapo As powerpoint.Slide
Dim Sh As powerpoint.Shape
Dim NbShpe As Integer
Dim Choix As String 'chemin du fichier
Dim a As Integer
Set Ppt = CreateObject("PowerPoint.Application")
Ppt.Visible = True ' Indispensable, sinon il ne peut pas ouvrir de fichier (Erreur)
' Et on lui dit de quelle présentation il s'agit :
Set Pres = Ppt.Presentations.Open(Filename:=gstrNomFichierPpt)
Pres.Slides(1).Select
Set Sh = Pres.Slides(1).Shapes("Sous titre")
With Sh.TextFrame.TextRange
.Text = Application.Workbooks(gstrMacro).Worksheets("Feuil1").Range("B8")
End With
'-------------------------------------------------------------------------------------------------------------------------------------
If gblnChoixSemaine = True Then
Pres.Slides(2).Select
Set Sh = Pres.Slides(2).Shapes("Titre")
With Sh.TextFrame.TextRange
.Text = Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Range("A13")
End With
'Remplissage du Graphique 1
Set Sh = Pres.Slides(2).Shapes("Graphique 1")
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(1, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(1, 2).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(2, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(2, 1).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(3, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(3, 1).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(4, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(4, 1).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(5, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(5, 1).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(2, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(2, 2).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(3, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(3, 2).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(4, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(4, 2).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(5, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(5, 2).Value
'Remplissage du Graphique 2
Set Sh = Pres.Slides(2).Shapes("Graphique 2")
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(1, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(1, 5).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(2, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(2, 4).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(3, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(3, 4).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(4, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(4, 4).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(5, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(5, 4).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(2, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(2, 5).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(3, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(3, 5).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(4, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(4, 5).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(5, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(5, 5).Value
'Remplissage du Graphique 3
Set Sh = Pres.Slides(2).Shapes("Graphique 3")
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(1, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(1, 8).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(2, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(2, 7).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(3, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(3, 7).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(4, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(4, 7).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(5, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(5, 7).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(2, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(2, 8).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(3, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(3, 8).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(4, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(4, 8).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(5, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(5, 8).Value
'Remplissage du Graphique 4
Set Sh = Pres.Slides(2).Shapes("Graphique 4")
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(1, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(1, 11).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(2, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(2, 10).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(3, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(3, 10).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(4, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(4, 10).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(5, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(5, 10).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(2, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(2, 11).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(3, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(3, 11).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(4, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(4, 11).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(5, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(5, 11).Value
'Remplissage du Graphique 5
Set Sh = Pres.Slides(2).Shapes("Graphique 5")
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(1, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(1, 14).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(2, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(2, 13).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(3, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(3, 13).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(4, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(4, 13).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(5, 1).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(5, 13).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(2, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(2, 14).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(3, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(3, 14).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(4, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(4, 14).Value
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(5, 2).Value = Excel.Application.Workbooks(gstrMacro).Worksheets("ResumeSemaine").Cells(5, 14).Value
'---------------------------------------------------------------------------------------------------------------------------------------------
'graphique entreprise Administratif et Sécurité
'selection slide entreprise
Pres.Slides(3).Select
'création du titre du slide
Set Sh = Pres.Slides(3).Shapes("Titre")
With Sh.TextFrame.TextRange
.Text = Application.Workbooks(gstrMacro).Worksheets("Feuil1").Range("A23")
End With
'Remplissage du Graphique 1
Set Sh = Pres.Slides(3).Shapes("Graphique 1")
a = 0
For j = 1 To gcolListeSST.Count
If gcolSSTSecuConf.Item(j) <> 0 Or gcolSSTSecuNok.Item(j) <> 0 Or gcolSSTSecuNonR.Item(j) <> 0 Or gcolSSTSecuNonAp.Item(j) <> 0 Then
If Not gcolListeSST.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 1).Value = gcolListeSST.Item(j)
End If
If Not gcolSSTSecuConf.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 2).Value = gcolSSTSecuConf.Item(j)
End If
If Not gcolSSTSecuNok.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 3).Value = gcolSSTSecuNok.Item(j)
End If
If Not gcolSSTSecuNonR.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 4).Value = gcolSSTSecuNonR.Item(j)
End If
If Not gcolSSTSecuNonAp.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 5).Value = gcolSSTSecuNonAp.Item(j)
End If
Else
a = a + 1
End If
Next j
Set gcolSSTSecuConf = Nothing
Set gcolSSTSecuNok = Nothing
Set gcolSSTSecuNonR = Nothing
Set gcolSSTSecuNonAp = Nothing
'---------------------------------------------------------------------------------------------------------------------------------------------
'graphique entreprise Contrôle
'selection slide entreprise
Pres.Slides(4).Select
'création du titre du slide
Set Sh = Pres.Slides(4).Shapes("Titre")
With Sh.TextFrame.TextRange
.Text = Application.Workbooks(gstrMacro).Worksheets("Feuil1").Range("A24")
End With
'Remplissage du Graphique 1
Set Sh = Pres.Slides(4).Shapes("Graphique 1")
a = 0
For j = 1 To gcolListeSST.Count
If gcolSSTContConf.Item(j) <> 0 Or gcolSSTContNok.Item(j) <> 0 Or gcolSSTContNonR.Item(j) <> 0 Or gcolSSTContNonAp.Item(j) <> 0 Then
If Not gcolListeSST.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 1).Value = gcolListeSST.Item(j)
End If
If Not gcolSSTContConf.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 2).Value = gcolSSTContConf.Item(j)
End If
If Not gcolSSTContNok.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 3).Value = gcolSSTContNok.Item(j)
End If
If Not gcolSSTContNonR.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 4).Value = gcolSSTContNonR.Item(j)
End If
If Not gcolSSTContNonAp.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 5).Value = gcolSSTContNonAp.Item(j)
End If
Else
a = a + 1
End If
Next j
Set gcolSSTContConf = Nothing
Set gcolSSTContNok = Nothing
Set gcolSSTContNonR = Nothing
Set gcolSSTContNonAp = Nothing
'---------------------------------------------------------------------------------------------------------------------------------------------
'graphique entreprise Pré Recette
'selection slide entreprise
Pres.Slides(5).Select
'création du titre du slide
Set Sh = Pres.Slides(5).Shapes("Titre")
With Sh.TextFrame.TextRange
.Text = Application.Workbooks(gstrMacro).Worksheets("Feuil1").Range("A25")
End With
'Remplissage du Graphique 1
Set Sh = Pres.Slides(5).Shapes("Graphique 1")
a = 0
For j = 1 To gcolListeSST.Count
If gcolSSTPreRConf.Item(j) <> 0 Or gcolSSTPreRNok.Item(j) <> 0 Or gcolSSTPreRNonR.Item(j) <> 0 Or gcolSSTPreRNonAp.Item(j) <> 0 Then
If Not gcolListeSST.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 1).Value = gcolListeSST.Item(j)
End If
If Not gcolSSTPreRConf.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 2).Value = gcolSSTPreRConf.Item(j)
End If
If Not gcolSSTPreRNok.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 3).Value = gcolSSTPreRNok.Item(j)
End If
If Not gcolSSTPreRNonR.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 4).Value = gcolSSTPreRNonR.Item(j)
End If
If Not gcolSSTPreRNonAp.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 5).Value = gcolSSTPreRNonAp.Item(j)
End If
Else
a = a + 1
End If
Next j
Set gcolSSTPreRConf = Nothing
Set gcolSSTPreRNok = Nothing
Set gcolSSTPreRNonR = Nothing
Set gcolSSTPreRNonAp = Nothing
'---------------------------------------------------------------------------------------------------------------------------------------------
'graphique entreprise Recette
'selection slide entreprise
Pres.Slides(6).Select
'création du titre du slide
Set Sh = Pres.Slides(6).Shapes("Titre")
With Sh.TextFrame.TextRange
.Text = Application.Workbooks(gstrMacro).Worksheets("Feuil1").Range("A26")
End With
'Remplissage du Graphique 1
Set Sh = Pres.Slides(6).Shapes("Graphique 1")
a = 0
For j = 1 To gcolListeSST.Count
If gcolSSTRecConf.Item(j) <> 0 Or gcolSSTRecNok.Item(j) <> 0 Or gcolSSTRecNonR.Item(j) <> 0 Or gcolSSTRecNonAp.Item(j) <> 0 Then
If Not gcolListeSST.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 1).Value = gcolListeSST.Item(j)
End If
If Not gcolSSTRecConf.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 2).Value = gcolSSTRecConf.Item(j)
End If
If Not gcolSSTRecNok.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 3).Value = gcolSSTRecNok.Item(j)
End If
If Not gcolSSTRecNonR.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 4).Value = gcolSSTRecNonR.Item(j)
End If
If Not gcolSSTRecNonAp.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 5).Value = gcolSSTRecNonAp.Item(j)
End If
Else
a = a + 1
End If
Next j
Set gcolSSTRecConf = Nothing
Set gcolSSTRecNok = Nothing
Set gcolSSTRecNonR = Nothing
Set gcolSSTRecNonAp = Nothing
'---------------------------------------------------------------------------------------------------------------------------------------------
'graphique entreprise Audit
'selection slide entreprise
Pres.Slides(7).Select
'création du titre du slide
Set Sh = Pres.Slides(7).Shapes("Titre")
With Sh.TextFrame.TextRange
.Text = Application.Workbooks(gstrMacro).Worksheets("Feuil1").Range("A27")
End With
'Remplissage du Graphique 1
Set Sh = Pres.Slides(7).Shapes("Graphique 1")
a = 0
For j = 1 To gcolListeSST.Count
If gcolSSTAudConf.Item(j) <> 0 Or gcolSSTAudNok.Item(j) <> 0 Or gcolSSTAudNonR.Item(j) <> 0 Or gcolSSTAudNonAp.Item(j) <> 0 Then
If Not gcolListeSST.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 1).Value = gcolListeSST.Item(j)
End If
If Not gcolSSTAudConf.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 2).Value = gcolSSTAudConf.Item(j)
End If
If Not gcolSSTAudNok.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 3).Value = gcolSSTAudNok.Item(j)
End If
If Not gcolSSTAudNonR.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 4).Value = gcolSSTAudNonR.Item(j)
End If
If Not gcolSSTAudNonAp.Item(j) = "0" Then
Sh.Chart.ChartData.Workbook.Worksheets(1).Cells(j + 1 - a, 5).Value = gcolSSTAudNonAp.Item(j)
End If
Else
a = a + 1
End If
Next j
Set gcolListeSST = Nothing
Set gcolSSTAudConf = Nothing
Set gcolSSTAudNok = Nothing
Set gcolSSTAudNonR = Nothing
Set gcolSSTAudNonAp = Nothing
End If
End Sub |
Partager