Solved

Powerpoint Macro to edit header

Posted on 2016-10-18
8
47 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article will show you how to use shortcut menus in the Access run-time environment.
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
The viewer will learn how to  create a slide that will launch other presentations in Microsoft PowerPoint. In the finished slide, each item launches a new PowerPoint presentation and when each is finished it automatically comes back to this slide: …

740 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