Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Open_PowerPoint_Presentation()
- Dim objPPT As Object
- Dim PPTPrez As Object
- Dim pSlide As Object
- Dim myShape As Object
- Dim fileNameString As String
- Dim PicCount As Long
- Dim i As Long
- Dim fileN As String
- Set objPPT = CreateObject("PowerPoint.Application")
- objPPT.Visible = True
- Sub Open_PowerPoint_Presentation()
- Dim objPPT As Object
- Dim PPTPrez As Object
- Dim pSlide As Object
- Dim myShape As Object
- Dim fileNameString As String
- Dim PicCount As Long
- Dim i As Long
- Dim fileN As String
- Set objPPT = CreateObject("PowerPoint.Application")
- objPPT.Visible = True
- Application.ScreenUpdating = False
- For i = 2 To 12
- Worksheets("Info").Cells(3, 2) = Worksheets("Temp").Cells(5, i)
- Worksheets("Info").Cells(4, 2) = Worksheets("Temp").Cells(6, i)
- Worksheets("Info").Cells(5, 2) = Worksheets("Temp").Cells(7, i)
- Worksheets("Info").Cells(6, 2) = Worksheets("Temp").Cells(8, i)
- Worksheets("Info").Cells(3, 3) = Worksheets("Temp").Cells(10, i)
- Worksheets("Info").Cells(4, 3) = Worksheets("Temp").Cells(11, i)
- Worksheets("Info").Cells(5, 3) = Worksheets("Temp").Cells(12, i)
- Worksheets("Info").Cells(6, 3) = Worksheets("Temp").Cells(13, i)
- fileN = Worksheets("Temp").Cells(4, i)
- Set PPTPrez = objPPT.Presentations.Open("C:Site Reports" & fileN & ".pptx")
- Set rng = Worksheets("Info").Range("A2:C6")
- Set pSlide = PPTPrez.Slides(6)
- For PicCount = PPTPrez.Slides(6).Shapes.Count To 1 Step -1
- If PPTPrez.Slides(6).Shapes(PicCount).Type = msoPicture Then
- PPTPrez.Slides(6).Shapes(PicCount).Delete
- End If
- Next
- 'Table
- rng.Copy
- pSlide.Shapes.PasteSpecial DataType:=2
- Set myShape = pSlide.Shapes(pSlide.Shapes.Count)
- 'Set position:
- myShape.Left = 36
- myShape.Top = 175
- myShape.Height = 150.23
- fileNameString = "C:Site Reports" & fileN & ".pptx"
- PPTPrez.SaveAs fileNameString
- PPTPrez.Close
- objPPT.Quit
- Next i
- Application.ScreenUpdating = True
Add Comment
Please, Sign In to add comment