+ Reply to Thread
Results 1 to 7 of 7

Excel 2007 VBA code to close powerpoint slide show, but not powerpoint application

  1. #1
    Registered User
    Join Date
    04-23-2014
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    21

    Question Excel 2007 VBA code to close powerpoint slide show, but not powerpoint application

    Hi, I am trying to create VBA code which opens a powerpoint application, runs a specific powerpoint slideshow, then closes the slideshow, but leaves powerpoint open in the background. The code I have so far is:

    Please Login or Register  to view this content.
    This works, but it closes the powerpoint application, not only the slide show.

    I have also tried this code:

    Please Login or Register  to view this content.
    This doesn't even start the slide show as I get a "Compile error: User defined type not defined" for
    Dim PPApp As PowerPoint.Application
    I have also tried combining elements of the two like this:

    Please Login or Register  to view this content.
    This opens and runs, but will not close, as I get the error
    Run-time error '438': Object doesn't support this property or method
    For the "PPPres.Close" command. I have also tries "PPPres.Presentations.Close" and:

    Please Login or Register  to view this content.
    but all with the same result. I can't think of any alternatives myself, so I need some genius help here.


    Any help with this will be greatly appreciated!

    Christopher

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: Excel 2007 VBA code to close powerpoint slide show, but not powerpoint application

    This creates powerpoint app and opens a file.
    I've included the command to run the slideshow if the fiile is not doing so automatically.

    Please Login or Register  to view this content.
    See this example for more detail on monitoring when it running.
    Cheers
    Andy
    www.andypope.info

  3. #3
    Registered User
    Join Date
    04-23-2014
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Excel 2007 VBA code to close powerpoint slide show, but not powerpoint application

    Hi Andy,

    Thanks, this works - to some extent It opens and starts, then closes the slideshow but leaves powerpoint open as I wanted. However, it doesn't actually show the presentation being run, that happens in the background. That was not the case before. I tried both with and without the run command, without a difference. Why is there a difference is behaviour, and is there some way of ensuring focus on the slide show being run?

    Best
    Christopher

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: Excel 2007 VBA code to close powerpoint slide show, but not powerpoint application

    I guess I forgot to include the see example link.

    http://officeone.mvps.org/vba/vb_run_complete_show.html

  5. #5
    Registered User
    Join Date
    04-23-2014
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Excel 2007 VBA code to close powerpoint slide show, but not powerpoint application

    Thaks Andy. So is it the
    State = SSW.View.State
    that will bring focus to the presentation?

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,419

    Re: Excel 2007 VBA code to close powerpoint slide show, but not powerpoint application

    Not really.

    Please Login or Register  to view this content.
    should start the slide show running. The view state is used to test what state the slide show is in.
    Once it's finished code should the continue to close the presentation.

  7. #7
    Registered User
    Join Date
    04-23-2014
    Location
    Norge
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Excel 2007 VBA code to close powerpoint slide show, but not powerpoint application

    Ok, so your first short bit of code works for me in that it does not close powerpoint, only the slide show, but it opens the ppsx invisibly in the background, whereas with my original code it would open on top of excel, which is how I need it to work. Why would there be a difference, I cannot see it?

    As of now the issue seems to be related to what I am doing on my second screen (I run the Excel sheet and the Powerpoint on my primary screen, but my Visual basic editor opens on a secondary screen). If I am working on some macros on the secondary screen the ppsx seems to open visibly on top of excel on the primary monitor, but if the secondary monitor is empty the ppsx opens invisibly. I haven't yet been able to identify exactly what triggers the ppsx to open visibly, but I can say that it never does so when I first run excel. Only after some fiddeling about with the Visual Basic editor will the ppsx show up. Strange...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. PowerPoint live update excel data during slide show
    By Tyger0951 in forum PowerPoint Formatting & General
    Replies: 8
    Last Post: 10-15-2019, 10:38 AM
  2. PowerPoint to automatically update while in slide show mode
    By angel2903 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-31-2015, 12:43 PM
  3. PowerPoint live update excel data during slide show
    By Tyger0951 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-31-2014, 02:51 AM
  4. two excel charts per powerpoint slide
    By stubyh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 12-09-2013, 11:09 AM
  5. PowerPoint interop without showing the PowerPoint application window
    By philippjb0 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-21-2013, 06:36 AM
  6. [SOLVED] How to Format PowerPoint 2007 Footer, Slide Number, Date.
    By Gnokrojam in forum PowerPoint Formatting & General
    Replies: 1
    Last Post: 02-03-2013, 04:56 PM
  7. Adding a Powerpoint slide using Excel vba
    By db1966 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-25-2008, 12:07 PM

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