It appears that you cross-posted this also at

http://www.excelforum.com/excel-programming/702626-excel-macro-to-close-powerpoint.html

For the benefit of the members of this forum, here the solution I sent
you:

Sub Workbook_Open()
    Dim PPApp As PowerPoint.Application
    Set PPApp = GetObject(, "PowerPoint.Application.11")  'or .12'
    If PPApp Is Nothing Then Exit Sub   'no active PowerPoint session
    Dim OpenPpt As PowerPoint.Presentation
    For Each OpenPpt In PPApp.Presentations
        OpenPpt.Close
    Next OpenPpt
    PPApp.Quit
End Sub

On Oct 8, 7:59 pm, Tony Bender <tony_ben...@yahoo.com> wrote:
> I have an Excel application that enables the user to export an Exccel
> chart directly into PowerPoint.  The macro to do this works fine
> provided PowerPoint was not already open.
>
> I am trying to figure the VB code so when the application opens it
> automatically closes PowerPoint - if in fact PowerPoint was open.
>
> Here's what I have so far but I'm getting errors ("ActiveX component
> can't create object):
>
> Sub Workbook_Open()
> Dim PPApp as PowerPoint.Application
> Set PPApp = PowerPoint.ActivePresentation
>
> With PPApp
>    .Saved = msoTrue
>    .Close
> end with
>
> UF1.show
> End Sub
>
> Can anyone point me in the right direction?
>
> Thank you,

--~--~---------~--~----~------------~-------~--~----~
----------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 6,500 subscribers worldwide and receive many nice notes about the 
learning and support from the group. Our goal is to have 10,000 subscribers by 
the end of 2009. Let friends and co-workers know they can subscribe to group at 
http://groups.google.com/group/excel-macros/subscribe
-~----------~----~----~----~------~----~------~--~---

Reply via email to