Solved

Powerpoint Macro to edit header

Posted on 2016-10-18
8
29 Views
Last Modified: 2016-11-28
I have been trying to edit the header/footer in Powerpoint using a macro, but have been unsuccessful.
The ActivePresentation.Slides(1).HeadersFooters.Header.Text is not working for me.
 Can someone help me out?
Unfortunately, recording a macro in Powerpoint is not a feature.

Thanks,
Janet
0
Comment
Question by:Janet Licciardi
  • 4
  • 3
8 Comments
 
LVL 9

Accepted Solution

by:
Jamie Garroch earned 500 total points (awarded by participants)
Comment Utility
Slides don't have headers so what are you trying to achieve? You can edit Footers for slides as follows:

Option Explicit

Sub EditHeaderText()
  Dim oSld As Slide
  For Each oSld In ActivePresentation.Slides
    With oSld.HeadersFooters.Footer
      If .Visible Then .Text = "this is my footer text"
    End With
  Next
End Sub

Open in new window


You can edit the header text for the Notes & Handout Masters like this:

Option Explicit

Sub EditHeaderText()
  With ActivePresentation.NotesMaster.HeadersFooters.Header
    .Visible = msoTrue
    .Text = "this is my header text"
  End With
End Sub

Open in new window


If this doesn't answer your need, can you upload an example PowerPoint file showing what you're trying to do?

And yes, there is no Macro recording feature in PowerPoint. The best way to start writing VBA code is to buy a beginners book, grab a coffee and start experimenting :-)

The part of this learning process that takes the longest is becomming familiar with the PowerPoint VBA Object Model e.g. where all these properties exist. Fortunately, it's usually quite logical in its hierarchical approach and IntelliSense helps. You can see IntelliSense in action when you type something in the Immediate window (Ctrl+G if you don't see it in the VBE) and type valid code followed by a dot e.g. typing ?ActivePresentation. in the Immediate window will show you a drop down list of properties and methods available.
0
 

Author Comment

by:Janet Licciardi
Comment Utility
Thanks so much.  I will give it a try.
0
 
LVL 9

Expert Comment

by:Jamie Garroch
Comment Utility
Can we wait until the user has confirmed (or not) that my solution works?
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:Janet Licciardi
Comment Utility
Ok I see that it is a theme. I am trying to edit the theme of many .ppt files. So I am writing a Perl script to change it. But now I am thinking the Perl script should just apply a new theme to all the .ppt files. Hopefully it will use my new theme in place of the current theme.
0
 
LVL 9

Expert Comment

by:Jamie Garroch
Comment Utility
The original question stated "I have been trying to edit the header/footer in Powerpoint using a macro". I have provided code to edit the header using VBA. Please could you confirm that my answer is the solution to the original question?
0
 

Author Comment

by:Janet Licciardi
Comment Utility
Thanks for your help.  It's all set now.
0
 
LVL 9

Expert Comment

by:Jamie Garroch
Comment Utility
The answer and code provided answers the original question.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Preface: When I started this series, I used the term CommandBars because that is the Office Object class that it discusses. Unfortunately, when Microsoft introduced Office 2007, they replaced the standard Commandbar menus with "The Ribbon" and rem…
Outlook Free & Paid Tools
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now