title: Close Powerpoint Object with Excel VBA (NOT using Powerpoint.Application)
body: <p>Hoping someone can help me with some VBA code.  I use a VBA loop to paste Excel charts, text boxes, and tables into a Powerpoint template.  However, because I cannot be sure that the user will have the Powerpoint Object Library installed, I cannot use the Dim PPTApp as Powerpoint.Application type syntax.</p>
  
  <p>I use objects.  It works great.  Except for one piece: closing Powerpoint.</p>
  
  <p>Code:</p>
  
  <pre><code>Dim oPPTPres As Object  ' Late binding: This is a PowerPoint.Presentation but we cannot assume that the Microsoft PowerPoint 11 library will be loaded in the workbook that this module has been copied to.
  Dim oPPTShape As Object ' Late binding: This is a PowerPoint.Shapebut we cannot assume that the Microsoft PowerPoint 11 library will be loaded in the workbook that this module has been copied to.
  
  
  PPTFile = Range("PPTFile").value ' Read PowerPoint template file name
  Set oPPTPres = GetObject(PPTFile): oPPTPres.Application.Visible = msoTrue ' Switch to or open template file
  </code></pre>
  
  <p>.
  .
  .
  .</p>
  
  <pre><code>strNewPresPath = Range("OutputFileName").value
  oPPTPres.SaveAs strNewPresPath
  ' Range("PPTFile").value = strNewPresPath
  ScreenUpdating = True
  oPPTPres.Close 'Closes presentation but not Powerpoint
  oPPTPres.Application.Quit 'No noticeable effect
  </code></pre>
  
  <p>The active presentation will close, but Powerpoint itself stays open (with no file window open).  Then, because it is open, when the next one runs (I have a loop that will loop through and do many of these builds back-to-back), it opens up the template as well as the latest built Powerpoint file, creating system locking issues.</p>
  
  <p>Any ideas?</p>
  
  <p>Thank you very much for your help!</p>