Results 1 to 4 of 4
  1. #1

    Excel and PowerPoint Question (English/Excel 2000)

    I am trying to control PowerPoint from an Excel Macro. I want to open an excel file, copy a graph then turn on PowerPoint paste in the graph and then save the PowerPoint file. All of this works fine. However, I then want to close the presentation - which also works - but then I want to quit out of PowerPoint and that is where I am having trouble. Any thoughts? My code is presented below.

    Dim PPT As Object
    Dim PRES As Object

    Workbooks.Open Filename:= "C:"Y_Final.xls"

    Set PPT = CreateObject("PowerPoint.Application")
    PPT.Visible = True
    Set PRES = PPT.Presentations.Open("C:Presentation1.ppt")

    With PPT.ActivePresentation
    PPT.ActivePresentation.SaveAs _
    Filename:="C:My PPTsY_Final.ppt"
    End With

    Set PPT = Nothing

  2. #2
    Gold Lounger
    Join Date
    Dec 2000
    Hollywood (sorta), California, USA
    Thanked 0 Times in 0 Posts

    Re: Excel and PowerPoint Question (English/Excel 2000)


    What's the error? Your code works fine for me (I stripped out the Excel select and copy and just pasted whatever was in my clipboard). Worked fine.

    However, I would point out a couple minor things:

    You declare PRES, but never really use it except to open the .ppt. Instead of

    With PPT.ActivePresentation


    With PRES
    .SaveAs Filename:="bla bla"
    end with

    You might want to set PRES = nothing too.

    Are you trying to present PPT to the user to make changes, etc.? If so, could the user be exiting PPT? Your code would be trying to do the same and you'll get a nice ugly error dialog.

    Maybe you could explain the error you are getting...
    Kevin <IMG SRC= alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  3. #3
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Silicon Valley, USA
    Thanked 94 Times in 90 Posts

    Re: Excel and PowerPoint Question (English/Excel 2000)

    I have encountered the same thing automating Word from Excel. Even if I never display the application and dutifully close it and set the object variable to nothing, when I hit Ctrl+Alt+Del Winword is still running deep in the bowels of Windows. I think it runs until I exit Excel, but this was a while ago so I don't remember exactly.

    Solution was to set a reference to the object library under Tools References and use

    Dim wrdApp as Word.Application

    rather than using CreateObject. Don't know why, but it worked for me. Hope it works for PPT, too.

  4. #4

    Re: Excel and PowerPoint Question (English/Excel 2000)

    Thanks for your help. It seems that after some more work with the do-loop that this code was part of it works as is. I thought that the part I posted was the reason for the macro not working, however, it seems to have been the do-loop - Sorry about that.

Posting Permissions

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