Add presentation file name to each slide master
Problem
It's sometimes convenient to have the name of the current file included in a footer or as some other part of the file. The feature's built into Word and Excel. We've begged MS for it in PowerPoint too, to no avail.
So taking matters in hand ourselves, we'll let VBA do the job.
Solution
First run AddNamedShape with the slide presentation file or template file open. This adds a text box to each slide master in the presentation, then gives the text box a name so we can easily locate it later.
Then when you're ready to add the full filename of the presentation (or another presentation built off a template that's had this macro run on it), run AddPath. If you save the presentation under a new name or move it to a new location, run AddPath again to update the text.
Sub AddNamedShape() ' Run this once on each template or presentation to create a ' text shape on masters that we can find later with the next macro Dim x As Long Dim oSh As Shape With ActivePresentation ' On each slidemaster in the presentation: For x = 1 To .Designs.Count ' Create a textbox at 10 points from left, ' 100 points from bottom of slide ' Make it 25 points high, 300 points wide ' Change any of these numbers at will Set oSh = _ .Designs(1).SlideMaster.Shapes.AddTextbox(msoTextOrientationHorizontal, _ 10, _ .PageSetup.SlideHeight - 100, _ 300, _ 25) ' Give it a name so we can find it later oSh.Name = "FullPath" ' Add some formatting and dummy text With oSh.TextFrame.TextRange .Font.Name = "Arial" .Font.Size = 12 .Text = "Full name of file will appear here" End With Next End With End Sub Sub AddPath() ' Run this to add the full name of the presentation to the ' slide masters Dim x As Long With ActivePresentation On Error Resume Next ' in case the shape isn't there For x = 1 To .Designs.Count .Designs(x).SlideMaster.Shapes("FullPath").TextFrame.TextRange.Text _ = .FullName Next End With End Sub
See How do I use VBA code in PowerPoint? to learn how to use this example code.