Trying to create a macro to quickly enter in project names to ppt footers. I can only get the top level slide master to accept the input title. I've tried looping through the other slide master layouts with the new footer info but I keep getting errors at the line to write text to the footer in the For loop
Sub footchange()
Dim myValue As Variant
Dim sld As Slide
myValue = InputBox("Enter Presentation Name")
Set mySlidesHF = ActivePresentation.SlideMaster.HeadersFooters
'Add name to slide master footer
With mySlidesHF
.Footer.Visible = True
.Footer.Text = myValue + " | Confidential © 2020"
.SlideNumber.Visible = True
End With
'Add name to slide master layouts footers
For Each sld In ActivePresentation.Slides
With sld.HeadersFooters
.Footer.Visible = True
.Footer.Text = myValue + " | Confidential © 2020"
.SlideNumber.Visible = True
End With
Next
I was able to update all the master slides/layouts by adding a 2nd nested loop for the layouts in each master slide:
Sub footchange()
Dim myValue As Variant
Dim sld As Slide
'Add design and layout variables
Dim oMaster As Design
Dim cLay As CustomLayout
myValue = InputBox("Enter Presentation Name")
'Just to show you how many Masters you have
Debug.Print ActivePresentation.Designs.Count
'Loop through them
For Each oMaster In ActivePresentation.Designs
'Use actual Design
Set mySlidesHF = oMaster.SlideMaster
Set myLayoutsHF = oMaster.SlideMaster.CustomLayouts
'Add name to slide master footer
With mySlidesHF.HeadersFooters
.Footer.Visible = True
.Footer.Text = myValue + " | Confidential © 2020"
.SlideNumber.Visible = True
End With
'Add name to layouts
For Each cLay In myLayoutsHF
With cLay.HeadersFooters
.Footer.Visible = True
.Footer.Text = myValue + " | Confidential © 2020"
.SlideNumber.Visible = True
End With
Next cLay
Next oMaster
End Sub