?
Solved

Adding slide number to powerpoint with vb.net

Posted on 2014-02-21
2
Medium Priority
?
1,192 Views
Last Modified: 2014-02-24
I'm automating the creation of powerpoint presentation using VB.net and powerpoint 2010.  How can i make slide numbers visible programmatically?
0
Comment
Question by:HyperBPP
[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
2 Comments
 
LVL 52

Accepted Solution

by:
Rgonzo1971 earned 1200 total points
ID: 39879031
Hi,

With VBA it should be
Sub Macro()
For Each sld In ActivePresentation.Slides
    With sld.HeadersFooters
        .SlideNumber.Visible = msoTrue
    End With
Next
End Sub

Open in new window

Regards
0
 
LVL 23

Assisted Solution

by:JSRWilson
JSRWilson earned 800 total points
ID: 39879578
Rgonzo's code will add numbers to all existing slides.

However if you mean set the default for NEW slides to numbered that is a different matter.

Don't think it's possible in vba except by using executeMso and sendkeys which may not be reliable

Sub numl()
Dim osld As Slide
Dim ocust As CustomLayout
ActiveWindow.Selection.Unselect ' ensure no text selected
Set ocust = ActivePresentation.SlideMaster.CustomLayouts(2)
Set osld = ActivePresentation.Slides.AddSlide(1, ocust)
If Not osld.HeadersFooters.SlideNumber.Visible Then ' check if already set to show all
PowerPoint.Application.CommandBars.ExecuteMso ("HeaderFooterInsert")
SendKeys ("%N")
SendKeys ("%Y")
SendKeys ("ESC")
End If
osld.Delete
End Sub
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
A lot of things can happen during a presentation, worst of which is “death by PowerPoint.” Here are a few mistakes to avoid to make your slides clean.
This video teaches viewers how to fit pictures into slides, crop and remove backgrounds, and alter photos to look more professional.
The viewer will learn how to edit animations within the presentation, incorporate sound, and set everything up with timing.

719 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