Bonjour à tous,
Je suis en train de faire une macro qui doit me permettre d'exporter des graphiques depuis Excel vers PPT.
J'arrive à copier/coller les graphiques (je fais des pastes special jpeg).
Ensuite j'aimerais utiliser des macros de retaille/repositionnement des images. Malheureusement, je n'arrive pas a adapter ces macros qui ont été écrites sous PPT et qui (si j'ai bien compris) ont été crées pour être utilisées sur un seul slide.
Voici la macro d'origine :
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 Sub FourGraphsMatrix() Dim osld As Slide Dim oshp As Shape Dim x As Integer Dim y As Integer For Each osld In ActivePresentation.Slides If osld.SlideIndex > 1 Then Exit Sub For Each oshp In osld.Shapes If CheckIsPic(oshp) = True Then With oshp .LockAspectRatio = msoFalse .Width = 315 .Height = 200 .Top = 90 + y * 205 .Left = 25 + x * 350 .Select Replace:=False 'Select picture but keep any others selected End With x = x + 1 If x = 2 Then y = y + 1 x = 0 End If End If Next oshp Next osld End Sub
Voici l'adaptation que j'ai faite :
Où Prez est la présentation ppt qui contient mes images.
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 Sub FourGraphsMatrix(Prez) Dim osld As Slide Dim oshp As Shape Dim x As Integer Dim y As Integer For Each osld In Prez.Slides For Each oshp In osld.Shapes If CheckIsPic(oshp) = True Then With oshp .LockAspectRatio = msoFalse .Width = 315 .Height = 200 .Top = 90 + y * 205 .Left = 25 + x * 350 .Select Replace:=False 'Select picture but keep any others selected End With x = x + 1 If x = 2 Then y = y + 1 x = 0 End If End If Next oshp Next osld End Sub
L'erreur apparait à la deuxième ligne :
C'est une erreur runtime 13 de type mismatch.
Code : Sélectionner tout - Visualiser dans une fenêtre à part For Each oshp In osld.Shapes
Voilà, je ne comprends pas pourquoi la première macro marche et pas la deuxième.
Je vous remercie par avance.
Partager