hawk771960
New Member
- Joined
- Jun 23, 2015
- Messages
- 10
Building a PowerPoint presentation from Excel. PowerPoint and the file open properly and it fails when selecting the PowerPoint Slide. Feel free to comment on other coding adjustments you feel need cleaning up.
Sub OpenPPTPresent() 'Opens a PowerPoint Document from Excel
Dim PPT As Object
Dim Slide As Object
Dim Shape As Object
Dim PPTFile As String
Dim mcdb As Workbook
Dim FilePathFileName As String
Set mcdb = ActiveWorkbook
Set PPT = CreateObject("PowerPoint.Application")
FilePathFileName = "R:\Test\KGN MCDB Blank.pptx"
mcdb.Sheets("Report Summary").Range("B2:F2").Copy
PPT.Visible = True
PPT.Presentations.Open FilePathFileName
Slide = "EHS" ' Here is where I am having trouble ********
Slide.Slides.PasteSpecial DataType:=2
'Slide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile
'Shape.Left = 66
'Shape.Top = 152
End Sub
Sub OpenPPTPresent() 'Opens a PowerPoint Document from Excel
Dim PPT As Object
Dim Slide As Object
Dim Shape As Object
Dim PPTFile As String
Dim mcdb As Workbook
Dim FilePathFileName As String
Set mcdb = ActiveWorkbook
Set PPT = CreateObject("PowerPoint.Application")
FilePathFileName = "R:\Test\KGN MCDB Blank.pptx"
mcdb.Sheets("Report Summary").Range("B2:F2").Copy
PPT.Visible = True
PPT.Presentations.Open FilePathFileName
Slide = "EHS" ' Here is where I am having trouble ********
Slide.Slides.PasteSpecial DataType:=2
'Slide.Shapes.PasteSpecial DataType:=2 '2 = ppPasteEnhancedMetafile
'Shape.Left = 66
'Shape.Top = 152
End Sub