+ Reply to Thread
Results 1 to 10 of 10

Excel macro to close PowerPoint

  1. #1
    Registered User
    Join Date
    01-20-2006
    Posts
    6

    Excel macro to close PowerPoint

    I have an Excel application that enables the user to export an Excel chart directly into PowerPoint. The macro to do this works fine provided PowerPoint wasn't already open.

    I am trying to figure the code so when the Excel application opens - it automatically closes any open PowerPoint.ppt - if in fact there are any open PowerPoint.ppt.

    Here's what I have so far but I'm getting errors
    Please Login or Register  to view this content.
    Can anyone point me in the right direction?

    Thank you,
    Last edited by Leith Ross; 10-09-2009 at 01:13 AM. Reason: Added Code tags

  2. #2
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Excel macro to close PowerPoint

    Please read the forum rules and then edit your post to wrap code in code tags.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Excel macro to close PowerPoint

    Hello Tony Bender,

    Welcome to the Forum!

    To make your posts easier to read, copy, and edit please wrap your code. I did it for you this time. Here is how you can do it next time.

    How to wrap your Code
    1. Select all your code using the mouse.
    2. Click on the # icon on the toolbar in the Message window. This will automatically wrap the text you selected with the proper Code tags to create a Code Window in your post.

    Use the Bulletin Board Code Tags
    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] at the end of the last line.


    To learn more about BB codes used in this forum, just click on the link below...

    Bulletin Board Codes Tags
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    RolfJ
    Guest

    Re: Excel macro to close PowerPoint

    Give this code a try:

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-20-2006
    Posts
    6

    Re: Excel macro to close PowerPoint

    Rolf, thank you very much...that did it

  6. #6
    RolfJ
    Guest

    Re: Excel macro to close PowerPoint

    Glad this worked for you. When you have a moment I would appreciate it if you were to click on the 'Add to answerers reputation' icon in the right-upper corner in the dark-blue band above the post.

    Best wishes,
    Rolf Jaeger
    SoarentComputing
    http://soarentcomputing.com

    Phone: 800.580.0068
    Cell: 510.300.7462

  7. #7
    Registered User
    Join Date
    01-20-2006
    Posts
    6

    Re: Excel macro to close PowerPoint

    Rolf,

    While this worked initially, when I had open PPT's, now when there are now open PPT's I get the following error:

    Run time error 429
    ActiveX Component can't create object

    When I click on debug it highlights:
    Set PPApp = GetObject(, "PowerPoint.Application.11") 'or .12'

    In the references I have:
    Microsoft ActiveX Data Objects 2.8 Library
    Microsoft ActiveX Data Objects Recordset 2.8 Library
    Microsoft ActiveX Plugin

    Here's the code:

    Please Login or Register  to view this content.
    Should I put something like
    Please Login or Register  to view this content.

    Thanks Rolf,

  8. #8
    RolfJ
    Guest

    Re: Excel macro to close PowerPoint

    Hi Tony:

    sorry about the delayed response! By now you probably already figured this out by yourself. Yes, you should do exactly what you suggested: simply insert an On Error Resume Next statement before the GetObject statement. It would however be prudent to clear that error handling directive with an On Error Goto 0 statement after the GetObject statement. Hence the section of your code containing the GetObject statement should look like this:

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    08-04-2011
    Location
    Brussels, Belgium
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Excel macro to close PowerPoint

    How can I open a powerpoint presentation and update all links to excel graphs using a macro. If possible how can I present in slide show mode after updating.
    Thanks in advance for your help

  10. #10
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,375

    Re: Excel macro to close PowerPoint

    @eyong123:

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread. It makes sense to have a new thread for your question because a thread with numerous replies can be off putting & difficult to pick out relevant replies.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1