ActiveX can't create object powerpont vba
<p>I am trying to copy 1st slide from the powerpoint and insert it at the end but I am getting ActiveX can't create object on the line</p>

<pre><code>ActivePresentation.Slides(1).Copy
</code></pre>

<p>This is my full code and I've added the reference to microsoft powerpoint library as well</p>

<pre><code>Option Explicit

Dim myFile, Fileselected As String, Path As String, objPPT As Object
Dim activeSlide As PowerPoint.Slide

Sub Generate_PPTs()

Application.ScreenUpdating = False

Set myFile = Application.FileDialog(msoFileDialogOpen)
With myFile
    .Title = "Choose Template PPT File."
    .AllowMultiSelect = False
If .Show &lt;&gt; -1 Then
    Exit Sub
End If
    Fileselected = .SelectedItems(1)
End With
Path = Fileselected

Set objPPT = CreateObject("PowerPoint.Application")
Set objPPT = objPPT.Presentations.Open(Path)

Debug.Print objPPT.Name

ActivePresentation.Slides(1).Copy
ActivePresentation.Slides.Paste Index:=objPPT.Slides.Count + 1

Set activeSlide = objPPT.Slides(objPPT.Slides.Count)

Application.ScreenUpdating = True
Set objPPT = Nothing

End Sub
</code></pre>