You are on page 1of 7

Private Sub CommandButton1_Click()

Unload Me
' On dclare une variable de type Application PowerPoint
Dim ppt As PowerPoint.Application
Set ppt = CreateObject("PowerPoint.Application")
ppt.Visible = True
' On cre maintenant un objet Presentation
Dim Pres As PowerPoint.Presentation
' Et on lui dit de quelle prsentation il s'agit :
Set Pres = ppt.Presentations.Open(FileName:="C:\Users\Dibaledias\Documents\ssv
_example.pptx")
'affectation des images a leurs slides
Dim img As InlineShape
Set img = ActiveDocument.InlineShapes(2)
If img.Type = wdInlineShapePicture Then
img.Select
img.Width = 749
img.Height = 382
Selection.Copy
With Pres.Slides(8).Shapes
With .Paste
.Shadow.Type = msoShadow6
.Align msoAlignCenters, True
.Top = 70
.ZOrder msoSendToBack
End With
End With
End If
'legende
Set img = ActiveDocument.InlineShapes(3)
If img.Type = wdInlineShapePicture Then
img.Select
Selection.Copy
With Pres.Slides(8).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.Left = 755
End With
End With
End If
Set img = ActiveDocument.InlineShapes(5)
If img.Type = wdInlineShapePicture Then
img.Select
img.Width = 749
img.Height = 382
Selection.Copy
With Pres.Slides(9).Shapes

With .Paste
.Align msoAlignCenters, True
.Top = 70
.ZOrder msoSendToBack
End With
End With
End If
'legende
Set img = ActiveDocument.InlineShapes(6)
If img.Type = wdInlineShapePicture Then
img.Select
Selection.Copy
With Pres.Slides(9).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.Left = 755
End With
End With
End If
Set img = ActiveDocument.InlineShapes(8)
If img.Type = wdInlineShapePicture Then
img.Select
img.Width = 749
img.Height = 382
Selection.Copy
With Pres.Slides(10).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.ZOrder msoSendToBack
End With
End With
End If
'legende
Set img = ActiveDocument.InlineShapes(9)
If img.Type = wdInlineShapePicture Then
img.Select
Selection.Copy
With Pres.Slides(10).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.Left = 755
End With
End With
End If
Set img = ActiveDocument.InlineShapes(11)
If img.Type = wdInlineShapePicture Then
img.Select
img.Width = 749
img.Height = 382

Selection.Copy
With Pres.Slides(11).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.ZOrder msoSendToBack
End With
End With
End If
'legende
Set img = ActiveDocument.InlineShapes(12)
If img.Type = wdInlineShapePicture Then
img.Select
Selection.Copy
With Pres.Slides(11).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.Left = 755
End With
End With
End If
Set img = ActiveDocument.InlineShapes(14)
If img.Type = wdInlineShapePicture Then
img.Select
img.Width = 749
img.Height = 382
Selection.Copy
With Pres.Slides(12).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.ZOrder msoSendToBack
End With
End With
End If
'legende
Set img = ActiveDocument.InlineShapes(15)
If img.Type = wdInlineShapePicture Then
img.Select
Selection.Copy
With Pres.Slides(12).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.Left = 755
End With
End With
End If
Set img = ActiveDocument.InlineShapes(17)

If img.Type = wdInlineShapePicture Then


img.Select
img.Width = 749
img.Height = 382
Selection.Copy
With Pres.Slides(13).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.ZOrder msoSendToBack
End With
End With
End If
'legende
Set img = ActiveDocument.InlineShapes(18)
If img.Type = wdInlineShapePicture Then
img.Select
Selection.Copy
With Pres.Slides(13).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.Left = 755
End With
End With
End If
Set img = ActiveDocument.InlineShapes(20)
If img.Type = wdInlineShapePicture Then
img.Select
img.Width = 749
img.Height = 382
Selection.Copy
With Pres.Slides(18).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.ZOrder msoSendToBack
End With
End With
End If
'legende
Set img = ActiveDocument.InlineShapes(21)
If img.Type = wdInlineShapePicture Then
img.Select
Selection.Copy
With Pres.Slides(18).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.Left = 755
End With
End With

End If
Set img = ActiveDocument.InlineShapes(23)
If img.Type = wdInlineShapePicture Then
img.Select
img.Width = 749
img.Height = 382
Selection.Copy
With Pres.Slides(19).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.ZOrder msoSendToBack
End With
End With
End If
'legende
Set img = ActiveDocument.InlineShapes(24)
If img.Type = wdInlineShapePicture Then
img.Select
Selection.Copy
With Pres.Slides(19).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.Left = 755
End With
End With
End If
Set img = ActiveDocument.InlineShapes(26)
If img.Type = wdInlineShapePicture Then
img.Select
img.Width = 749
img.Height = 382
Selection.Copy
With Pres.Slides(20).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70
.ZOrder msoSendToBack
End With
End With
End If
'legende
Set img = ActiveDocument.InlineShapes(27)
If img.Type = wdInlineShapePicture Then
img.Select
Selection.Copy
With Pres.Slides(20).Shapes
With .Paste
.Align msoAlignCenters, True
.Top = 70

.Left = 755
End With
End With
End If
'charger les donnes a partir de la base de donnes excel(EPT)
Dim xlApp As New Excel.Application
Dim xlbk As Excel.Workbook
Set xlbk = xlApp.Workbooks.Open("C:\Users\Dibaledias\Documents\ept.xlsx")
xlApp.Visible = True
Dim t As Shape
Dim L As Integer
Dim N As String
N = txt.Text
L = Columns("B").Find(N, lookat:=xlWhole).Row
Dim oPPTShape As PowerPoint.Shape
Set oPPTShape = Pres.Slides(5).Shapes(2)
Sheets("2G").Activate
For i = 1 To 3
'If oPPTShape.Table.Cell(i + 1, 2).Shape.TextFrame.TextRange.Text Like txt.Text
Then
oPPTShape.Table.Cell(i + 1, 1).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 12).Text
oPPTShape.Table.Cell(i + 1, 2).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 2).Text
oPPTShape.Table.Cell(i + 1, 3).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 5).Text
oPPTShape.Table.Cell(i + 1, 4).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 6).Text
oPPTShape.Table.Cell(i + 1, 5).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 7).Text
oPPTShape.Table.Cell(i + 1, 6).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 10).Text
oPPTShape.Table.Cell(i + 1, 7).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 11).Text
oPPTShape.Table.Cell(i + 1, 8).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 8).Text
oPPTShape.Table.Cell(i + 1, 9).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 9).Text
oPPTShape.Table.Cell(i + 1, 10).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 4).Text
'Else: End If
Next i
Set oPPTShape = Pres.Slides(5).Shapes(2)
Pres.Slides(3).Shapes(1).TextFrame.TextRange.Text = Cells(L, 2).Text
Set oPPTShape = Pres.Slides(8).Shapes(3)
Sheets("2G").Activate
For i = 1 To 3
'If oPPTShape.Table.Cell(i + 1, 2).Shape.TextFrame.TextRange.Text Like txt.Text
Then

oPPTShape.Table.Cell(i + 1, 1).Shape.TextFrame.TextRange.Text = Cells(L + i


- 1, 3).Text
oPPTShape.Table.Cell(i + 1, 2).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 5).Text
'Else: End If
Next i
Set oPPTShape = Pres.Slides(9).Shapes(3)
Sheets("2G").Activate
For i = 1 To 3
'If oPPTShape.Table.Cell(i + 1, 2).Shape.TextFrame.TextRange.Text Like txt.Text
Then
oPPTShape.Table.Cell(i + 1, 1).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 3).Text
oPPTShape.Table.Cell(i + 1, 2).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 11).Text
'Else: End If
Next i
Set oPPTShape = Pres.Slides(10).Shapes(3)
Sheets("2G").Activate
For i = 1 To 3
'If oPPTShape.Table.Cell(i + 1, 2).Shape.TextFrame.TextRange.Text Like txt.Text
Then
oPPTShape.Table.Cell(i + 1, 1).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 3).Text
oPPTShape.Table.Cell(i + 1, 2).Shape.TextFrame.TextRange.Text = Cells(L + i
- 1, 8).Text & Cells(L + i - 1, 9).Text
'Else: End If
Next i
L = 0
End Sub
Private Sub txt_Change()
End Sub
Private Sub UserForm_Click()
End Sub

You might also like