Solved

Powerpoint Macro to edit header

Posted on 2016-10-18
8
69 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
8 Comments
 
LVL 11

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 11

Expert Comment

by:Jamie Garroch
ID: 41857165
Can we wait until the user has confirmed (or not) that my solution works?
0
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

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 11

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 11

Expert Comment

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

Featured Post

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Suggested Solutions

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

738 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