简体   繁体   中英

Apply master slide to multiple powerpoints

I'm quite new to this. I have a bunch of powerpoint presentations that I would like to apply a master slide to. All the powerpoints are within subfolders of one folder (if that makes sense)

So if anyone can help with the code it would be greatly appreciated. the code should:

  1. Open FileDialog So I can choose the folder (Ihave the code below)

     Sub ShowFileDialog() Dim dlgOpen As FileDialog Set dlgOpen = Application.FileDialog(Type:=msoFileDialogOpen) With dlgOpen .AllowMultiSelect = True .Show End With End Sub
  2. Scan for powerpoints in the folder and for every ppt:

    • Delete current master template (include remove links)

    • Apply the new master template

    • save & close

Hope that makes sense. The current master template is saved as a file called "slidemaster". I am using MS powerpoint 2010.

Not sure what you mean by "remove links" but to apply a different template, you'd open a presentation, then:

ActivePresentation.ApplyTemplate sTemplate

where sTemplate = the full path to the POTX file containing your template.

This page on my PPTFAQ site explains how to do something to every file in a folder that matches a filespec:

Batch: Do something to every file in a folder http://www.pptfaq.com/FAQ00536_Batch-_Do_something_to_every_file_in_a_folder.htm

In this case, "something" would be running the line of code above then saving the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM