Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Powerpoint Macro to edit header

Posted on 2016-10-18
8
Medium Priority
?
196 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
7 Comments
 
LVL 12

Accepted Solution

by:
Jamie Garroch earned 2000 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 12

Expert Comment

by:Jamie Garroch
ID: 41857165
Can we wait until the user has confirmed (or not) that my solution works?
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

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 12

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 12

Expert Comment

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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
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…

773 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