Announcement

Collapse
No announcement yet.

Opening Powerpoint slide using VBA

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Opening Powerpoint slide using VBA



    I'm trying to open a ppt slide using the following code,

    Code:
        ' Create powerpoint page
        Dim pptPres As PowerPoint.Presentation
        Dim pptApp As PowerPoint.Application
        Dim pptSlide As PowerPoint.Slide
        Dim file As String
        file = "C:\Weekly Template.ppt"
    
        Set pptApp = CreateObject("PowerPoint.Application")
        Set pptPres = pptApp.Presentations.Open(file)

    When this is run, I get a run time error stating that Presentations ( unknown member): Invalid request. the Powerpoint Frame does not exist.

    If I manually open the file before running the VBA code, the rest of the code works fine, making changes to the slide. Can anyone help with why VBA is not opening the slide?

    Thanks in advance.

  • #2
    Re: Opening Powerpoint slide using VBA

    Hi,

    Try this, PowerPoint is not an app that likes to run invisibly
    Set pptApp = CreateObject("PowerPoint.Application") 
    pptApp.visible = True
    Set pptPres = pptApp.Presentations.Open(file)

    Cheers
    Andy

    Comment


    • #3


      Re: Opening Powerpoint slide using VBA

      Thanks. That worked a treat.

      Comment

      Working...
      X