How to properly close PowerPoint when using automation from Excel?

G

Guest

I’m looping through 10 slides in a PowerPoint presentation via automation
where the VBA is written in Excel. Each slide has two embedded Excel
workbooks that I’m pulling information from. After my procedure runs, there
is a VBAProject (Book x) listed in the Visual Basic Editor Project pane for
only the first embedded workbook of each slide. I was surprised to see this
because I end my procedure with my Presentation variable, ppPres = Nothing
and my PowerPoint Application variable, ppApp = Nothing. I used early
binding. I also have an Excel.Workbook variable called xlWkb where I wrote
xlWkb.close as the last line of code for pulling information from the
embedded workbook.
Can you tell me why I see VBAProjects, one for each of the first embedded
workbooks in the VBE? Also, the first time I run this code it takes 27
seconds, if I run it again, it takes 5 seconds. If I open the PowerPoint
presentation from Explorer and close it (saving or not saving), then rerun my
procedure it takes 27 seconds. What is the reason for this.

My loop procedure is very long, but hoping someone could shed some light.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top