Consulting

Results 1 to 6 of 6

Thread: PPT Master slide VBA help

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Nov 2023
    Posts
    5
    Location

    PPT Master slide VBA help

    Hi, I am trying to create a macro that will re-insert master slides from a template from a location on the network, in case people delete them, I have the code below, it seems to work and run fine, but when you go into the master the slides aren’t added. I am not fully confident in vba so need a little help if possible

    Thanks in advance

    Sub CopyMasterSlidesFromNetwork()    ' Specify the path to the PowerPoint file on the network
        Dim sourceFilePath As String
        sourceFilePath = "\\Network\Path\To\Your\Source\File.pptx" ' Replace with the actual network path
        ' Open the source presentation
        Dim sourcePresentation As Presentation
        Set sourcePresentation = Presentations.Open(sourceFilePath)
        ' Copy master slides from the source presentation
        Dim slideIndex As Integer
        For slideIndex = 1 To sourcePresentation.Slides.Count
            sourcePresentation.Slides(slideIndex).CustomLayout.Copy
            ActivePresentation.Designs(1).SlideMaster.CustomLayouts.Paste
        Next slideIndex
        ' Close the source presentation without saving changes
        sourcePresentation.Close False
    End Sub
    Last edited by Aussiebear; 12-29-2024 at 07:15 PM.

Posting Permissions

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