Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Oct 2004
    Location
    USA
    Posts
    223
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Excel Automation of PowerPoint (2000 sp3)

    I feel really dumb asking this because I must be missing something obvious. I'm having a problem getting PowerPoint to close when I issue the .close statement. If I make the window visible I can see it disappear from my task bar but when I go into the Task Manager window it is still listed as a running Process in the "Image Name" column. When I try to re-execute this code it sometimes works fine because it just grabs the open app. Other times it causes a catastrophic error that results in a message that says Excel.exe has caused a problem and must shut down.
    Please help! Any ideas are welcome! I copied the code to a fresh workbook and attached it:
    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel Automation of PowerPoint (2000 sp3)

    You must open the presentation in the instance of PowerPoint: replace the line

    Set objPPPres = GetObject(ActiveWorkbook.Path & "My Presentation.ppt")

    with

    objPPApp.Visible = True
    Set objPPPres = objPPApp.Presentations.Open(ActiveWorkbook.Path & "My Presentation.ppt")

  3. #3
    3 Star Lounger
    Join Date
    Oct 2004
    Location
    USA
    Posts
    223
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Excel Automation of PowerPoint (2000 sp3)

    Hans, you're amazing! That worked like a charm. Every place I've found that shows code to do automation uses the getobject. Your method is obviously the better way.
    Should I be using your open method for Word automation too?
    Thank you so much for your speedy reply!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Excel Automation of PowerPoint (2000 sp3)

    If you don't get/create an Application object, you can use GetObject to get hold of a document. But if you use an Application object, whether it is for Word, Excel or PowerPoint, you should use Open to open a document/workbook/presentation in the Application.

  5. #5
    3 Star Lounger
    Join Date
    Oct 2004
    Location
    USA
    Posts
    223
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Excel Automation of PowerPoint (2000 sp3)

    Thanks! I'm going back and checking all my other workbooks!

Posting Permissions

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