How To Insert One PowerPoint Presentation Into Another PowerPoint Presentation at A Specified Slide Number.

  • Hello everyone. This is my first time asking a question. I have a VBA problem that I am trying to solve. I am certain I have approached the problem correctly and am close to solving it.

    Brief Description:

    I want to insert a presentation FinalPPTXPresentation onto OmnibusPresentation after a specifying a slide number on OmnibusPresentation.

    Long Description:

    The goals is to have a VBA script that would loop through a folder called Test; which contains Omnibus.pptx, and find amongst its subfolders the path Test\ 0X.stringX \ Y.stringY \ Final \ Final.pptx and extract the value 0X.Y and then search Omnibus.pptx and locate the slide containing the text "Placeholder for slides from 0X.Y.". Once found it would remove that slide and insert the presentation Final.pptx.

    I have everything I need but the final punch; which is inserting one powerpoint presentation into another at a specific slide number. Note: My VBA code is contained on a module in Excel and not a pptx file. Whence the Excel tag.

    The "main" module:

    1. 'VBA Script to Generate PPT presentation
    2. Public Sub BuildOmnibusPointPresentation()
    3. Call RecursivelySearchFolder("\\\abc\def\ghi\jkl\mno\pqr\Test set up")
    4. End Sub

    Recursively search folders and subfolders:

    Extract placeholder index from folder structure. This is subtle. But what this nifty script does extract characters from a given string and concatenates them:

    This is where my programming skills get muddle and I become confused - but it works.

  • I figured it out myself:

    1. Dim FileInsert As Long
    2. FileInsert = OmnibusPresentation.Slides.InsertFromFile(temp & FinalPPTX, slideNumber)
    3. OmnibusPresentation.Slides(slideNumber).Delete