Solved

Powerpoint Macro to edit header

Posted on 2016-10-18
8
31 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 10

Accepted Solution

by:
Jamie Garroch earned 500 total points (awarded by participants)
ID: 41849552
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
ID: 41856981
Thanks so much.  I will give it a try.
0
 
LVL 10

Expert Comment

by:Jamie Garroch
ID: 41857165
Can we wait until the user has confirmed (or not) that my solution works?
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:Janet Licciardi
ID: 41857280
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 10

Expert Comment

by:Jamie Garroch
ID: 41861907
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
ID: 41880504
Thanks for your help.  It's all set now.
0
 
LVL 10

Expert Comment

by:Jamie Garroch
ID: 41903893
The answer and code provided answers the original question.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting the Scene Animations in PowerPoint are a great tool to convey messages when used carefuly with the content of your slides. There are plenty of animation effects and options, including a Repeat feature for individual animation effects. …
Outlook Free & Paid Tools
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

912 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

22 Experts available now in Live!

Get 1:1 Help Now