tiens voici un gros bout de mon code, peut etre y trouvera tu des infos, j'ai tout laissé au cas où:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
321
Sub XLtoPPT()
 
    Dim strTitre As String, strWhen As String, strDate As String
    Dim n As Integer, e As Integer
    Dim Ppa As PowerPoint.Application
    Dim Ppp As PowerPoint.Presentation
    Dim mySlide As Slide
    Dim NbShpe As Byte
 
    strWhen = "text1"
    strTitre = "text2"
 
    Set Ppa = CreateObject("Powerpoint.Application")
    Ppa.Visible = True
    Set Ppp = Ppa.Presentations.Open(Filename:="E:\Project\xltoppt.ppt", ReadOnly:=msoFalse)
 
    'pour effacer les slides dejà présent après le slide 1
    n = Ppp.Slides.Count
    While n > 1
        Ppp.Slides(n).Delete
        n = n - 1
    Wend
 
 
    'mise a jour de la page de garde
    Ppp.Slides(1).Shapes.AddTextbox(msoTextOrientationHorizontal, 108, 462, 228, 28.875).Select
    Ppp.Slides(1).Shapes.Range.TextFrame.WordWrap = msoTrue
    With Ppp.Slides(1).Shapes(1).TextFrame.TextRange.ParagraphFormat
        .LineRuleWithin = msoTrue
        .SpaceWithin = 1
        .LineRuleBefore = msoTrue
        .SpaceBefore = 0.5
        .LineRuleAfter = msoTrue
        .SpaceAfter = 0
    End With
    With Ppp.Slides(1).Shapes(1).TextFrame.TextRange
        .Text = "Last update on " & Date
        With .Font
            .Name = "Arial"
            .Size = 18
            .Bold = msoFalse
            .Italic = msoFalse
            .Underline = msoFalse
            .Shadow = msoFalse
            .Emboss = msoFalse
            .BaselineOffset = 0
            .AutoRotateNumbers = msoFalse
            .Color.RGB = RGB(Red:=255, Green:=255, Blue:=255)
        End With
    End With
 
 
'--------------------------------------------------------
    'Ajout du deuxieme slide
    Set mySlide = Ppp.Slides.Add(Index:=2, Layout:=ppLayoutText)
 
    'insertion texte dans les Shapes 1 et 2 du deuxième Slide
    Ppp.Slides(2).Shapes(1).TextFrame.TextRange.Text = strTitre
    With Ppp.Slides(2).Shapes(1).TextFrame.TextRange
        .Paragraphs.ParagraphFormat.Alignment = ppAlignCenter
        .Paragraphs.ParagraphFormat.Bullet.Visible = msoFalse
        With .Font
            .Size = 24
            .Name = "Arial"
            .Bold = msoTrue
            .Italic = msoFalse
            .Underline = msoFalse
            .Shadow = msoFalse
            .Emboss = msoFalse
            .BaselineOffset = 0
            .AutoRotateNumbers = msoFalse
            .Color.RGB = RGB(Red:=192, Green:=0, Blue:=0)
        End With
    End With
 
    'copie du graphique nommé "Gr1",contenu  dans la feuille active
    ThisWorkbook.Sheets("DataGraph").ChartObjects(1).Activate
    ActiveChart.ChartArea.Select
    ActiveChart.ChartArea.Copy
 
 
    'collage dans le Slide2 du document Power Point
    'compte le nombre de shapes dans le 2eme slide
    'le dernier objet inséré correspond à l'index le plus élevé
    NbShpe = Ppp.Slides(2).Shapes.Count
 
    'coller non pas sous format graph excel mais image
    Ppp.Slides(2).Shapes.PasteSpecial (ppPasteMetafilePicture)
    With Ppp.Slides(2).Shapes(Ppp.Slides(2).Shapes.Count)
        .Name = "monGraph" 'personnaliser le nom de l'image insérée
        .Left = 100 'position horizontale dans le slide
        .Top = 170 'position verticale dans le slide
        .Height = 520 'hauteur image
        .Width = 500 'largeur image
    End With
 
    Ppp.Slides(2).Shapes(NbShpe).TextFrame.TextRange.Text = strWhen
    With Ppp.Slides(2).Shapes(NbShpe).TextFrame.TextRange
        .Paragraphs.ParagraphFormat.Alignment = ppAlignCenter
        .Paragraphs.ParagraphFormat.Bullet.Visible = msoFalse
        With .Font
            .Size = 15
            .Name = "Arial"
            .Bold = msoTrue
            .Italic = msoFalse
            .Underline = msoTrue
            .Shadow = msoFalse
            .Emboss = msoFalse
            .BaselineOffset = 0
            .AutoRotateNumbers = msoFalse
            .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
        End With
    End With
 
'--------------------------------------------------------
    'Ajout slide 3
    Set mySlide = Ppp.Slides.Add(Index:=3, Layout:=ppLayoutText)
 
    'insertion texte dans les Shapes 1 et 2 du 3ème Slide
    Ppp.Slides(3).Shapes(1).TextFrame.TextRange.Text = strTitre
    With Ppp.Slides(3).Shapes(1).TextFrame.TextRange
        .Paragraphs.ParagraphFormat.Alignment = ppAlignCenter
        .Paragraphs.ParagraphFormat.Bullet.Visible = msoFalse
        With .Font
            .Size = 24
            .Name = "Arial"
            .Bold = msoTrue
            .Italic = msoFalse
            .Underline = msoFalse
            .Shadow = msoFalse
            .Emboss = msoFalse
            .BaselineOffset = 0
            .AutoRotateNumbers = msoFalse
            .Color.RGB = RGB(Red:=192, Green:=0, Blue:=0)
        End With
    End With
 
    'copie du graphique nommé "Gr2",contenu  dans la feuille active
    ThisWorkbook.Sheets("DataGraph").ChartObjects(2).Activate
    ActiveChart.ChartArea.Select
    ActiveChart.ChartArea.Copy
 
 
    'collage dans le Slide3 du document Power Point
    'compte le nombre de shapes dans le 2eme slide
    'le dernier objet inséré correspond à l'index le plus élevé
    NbShpe = Ppp.Slides(3).Shapes.Count
 
    Ppp.Slides(3).Shapes.PasteSpecial ppPasteMetafilePicture
    With Ppp.Slides(3).Shapes(Ppp.Slides(3).Shapes.Count)
        .Name = "monGraph" 'personnaliser le nom de l'image insérée
        .Left = 100 'position horizontale dans le slide
        .Top = 170 'position verticale dans le slide
        .Height = 520 'hauteur image
        .Width = 500 'largeur image
    End With
 
    strWhen = "text a remplir"
    Ppp.Slides(3).Shapes(2).TextFrame.TextRange.Text = strWhen
    With Ppp.Slides(3).Shapes(NbShpe).TextFrame.TextRange
        .Paragraphs.ParagraphFormat.Alignment = ppAlignCenter
        .Paragraphs.ParagraphFormat.Bullet.Visible = msoFalse
        With .Font
            .Size = 15
            .Name = "Arial"
            .Bold = msoTrue
            .Italic = msoFalse
            .Underline = msoTrue
            .Shadow = msoFalse
            .Emboss = msoFalse
            .BaselineOffset = 0
            .AutoRotateNumbers = msoFalse
            .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
        End With
    End With
 
'--------------------------------------------------------
    'Ajout slide 4
    Set mySlide = Ppp.Slides.Add(Index:=4, Layout:=ppLayoutText)
 
    strWhen = "text a remplir"
    strTitre = "text a remplir"
 
 
    'insertion texte dans les Shapes 1 et 2 du 4ème Slide
    Ppp.Slides(4).Shapes(1).TextFrame.TextRange.Text = strTitre
    With Ppp.Slides(4).Shapes(1).TextFrame.TextRange
        .Paragraphs.ParagraphFormat.Alignment = ppAlignCenter
        .Paragraphs.ParagraphFormat.Bullet.Visible = msoFalse
        With .Font
            .Size = 24
            .Name = "Arial"
            .Bold = msoTrue
            .Italic = msoFalse
            .Underline = msoFalse
            .Shadow = msoFalse
            .Emboss = msoFalse
            .BaselineOffset = 0
            .AutoRotateNumbers = msoFalse
            .Color.RGB = RGB(Red:=192, Green:=0, Blue:=0)
        End With
    End With
 
    'copie du graphique nommé "Gr1",contenu  dans la feuille active
    ThisWorkbook.Sheets("DataGraph2").ChartObjects(1).Activate
    ActiveChart.ChartArea.Select
    ActiveChart.ChartArea.Copy
 
 
    'collage dans le Slide3 du document Power Point
    'compte le nombre de shapes dans le 2eme slide
    'le dernier objet inséré correspond à l'index le plus élevé
    NbShpe = Ppp.Slides(4).Shapes.Count
 
    Ppp.Slides(4).Shapes.PasteSpecial ppPasteMetafilePicture
    With Ppp.Slides(4).Shapes(Ppp.Slides(4).Shapes.Count)
        .Name = "monGraph" 'personnaliser le nom de l'image insérée
        .Left = 100 'position horizontale dans le slide
        .Top = 170 'position verticale dans le slide
        .Height = 520 'hauteur image
        .Width = 500 'largeur image
    End With
 
    Ppp.Slides(4).Shapes(2).TextFrame.TextRange.Text = strWhen
    With Ppp.Slides(4).Shapes(NbShpe).TextFrame.TextRange
        .Paragraphs.ParagraphFormat.Alignment = ppAlignCenter
        .Paragraphs.ParagraphFormat.Bullet.Visible = msoFalse
        With .Font
            .Size = 15
            .Name = "Arial"
            .Bold = msoTrue
            .Italic = msoFalse
            .Underline = msoTrue
            .Shadow = msoFalse
            .Emboss = msoFalse
            .BaselineOffset = 0
            .AutoRotateNumbers = msoFalse
            .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
        End With
    End With
 
'--------------------------------------------------------
    'Ajout slide 5
    Set mySlide = Ppp.Slides.Add(Index:=5, Layout:=ppLayoutText)
 
    strWhen = "text a remplir"
    strTitre = "text a remplir"
 
 
    'insertion texte dans les Shapes 1 et 2 du 5ème Slide
    Ppp.Slides(5).Shapes(1).TextFrame.TextRange.Text = strTitre
    With Ppp.Slides(5).Shapes(1).TextFrame.TextRange
        .Paragraphs.ParagraphFormat.Alignment = ppAlignCenter
        .Paragraphs.ParagraphFormat.Bullet.Visible = msoFalse
        With .Font
            .Size = 24
            .Name = "Arial"
            .Bold = msoTrue
            .Italic = msoFalse
            .Underline = msoFalse
            .Shadow = msoFalse
            .Emboss = msoFalse
            .BaselineOffset = 0
            .AutoRotateNumbers = msoFalse
            .Color.RGB = RGB(Red:=192, Green:=0, Blue:=0)
        End With
    End With
 
    'copie du graphique nommé "Gr2",contenu  dans la feuille active
    ThisWorkbook.Sheets("DataGraph2").ChartObjects(2).Activate
    ActiveChart.ChartArea.Select
    ActiveChart.ChartArea.Copy
 
 
    'collage dans le Slide3 du document Power Point
    'compte le nombre de shapes dans le 2eme slide
    'le dernier objet inséré correspond à l'index le plus élevé
    NbShpe = Ppp.Slides(5).Shapes.Count
 
    Ppp.Slides(5).Shapes.PasteSpecial ppPasteMetafilePicture
    With Ppp.Slides(5).Shapes(Ppp.Slides(5).Shapes.Count)
        .Name = "monGraph" 'personnaliser le nom de l'image insérée
        .Left = 100 'position horizontale dans le slide
        .Top = 170 'position verticale dans le slide
        .Height = 520 'hauteur image
        .Width = 500 'largeur image
    End With
 
    Ppp.Slides(5).Shapes(2).TextFrame.TextRange.Text = strWhen
    With Ppp.Slides(5).Shapes(NbShpe).TextFrame.TextRange
        .Paragraphs.ParagraphFormat.Alignment = ppAlignCenter
        .Paragraphs.ParagraphFormat.Bullet.Visible = msoFalse
        With .Font
            .Size = 15
            .Name = "Arial"
            .Bold = msoTrue
            .Italic = msoFalse
            .Underline = msoTrue
            .Shadow = msoFalse
            .Emboss = msoFalse
            .BaselineOffset = 0
            .AutoRotateNumbers = msoFalse
            .Color.RGB = RGB(Red:=0, Green:=0, Blue:=0)
        End With
    End With
 
  '-------------------------------------------------------------
    'FIN: on sauvegarde et on quitte
    Ppp.SaveAs Filename:="C:\Project1\Analyse_v1.ppt"
    Ppp.Close
    Ppa.Quit
 
    Set mySlide = Nothing
    Set Ppp = Nothing
    Set Ppa = Nothing
 
 
    'retour sur la feuille excel
    Sheets("Control Panel").Select
 
End Sub
en espérant que cela t'aidera.
si tu ve d'autre info n'hésite pas à revenir.