Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Total number of slides in Powerpoint presentation footer 1

Status
Not open for further replies.

Aqif

Programmer
Apr 27, 2002
240
AU
Hi,

Is there any way of adding Total number of slides in footer text so that each slide will have same thing as word like <PageNumber> of <TotalPages>. You can put <#> in powerpoint to display the number of current slide

I tried putting <#> of <##> and some other combinations but no use.

Any siggestions?

Cheers!
ÙÇãá

It's important to learn the rules so that you know how to break them.
 
Agif,

I don't believe it's possible to do that.

All I can suggest is to manually enter the total number of slides and use the <#> for the current slide number.

Cheers


TAJ Simmons
microsoft powerpoint mvp

awesome - powerpoint backgrounds
 
Not a problem witha slight fiddle:

goto slide master, select the number area, insert slide number and then type in 'of x' (you'll have to type number in when you've completed presentation, haven't found a way of making this automatic)
 
Well,

I am already doing what both of you suggested and its quite funny that powerpoint doesn't offer such a standard feature.

Anyway thanks for the help.



Cheers!
ÙÇãá

It's important to learn the rules so that you know how to break them.
 
ActivePresentation.BuiltInDocumentProperties("Number of Slides")

gives the total number of slides in the saved file. If you have added X more, and call the above before saving, it will return only the previously saved count.

However, if you make the above a variable and dump into the footer...

Or am I missing something here?

Gerry
 
Fumei, a couple of steps in between would be nice if you wouldn't mind
 
A couple of steps between what? I simply stated that BuiltinDocumentProperties("Number of Slides") returns the total number of slides...which it does.

Ah, I guess you want code....oh,...well.

Code:
Sub SlideNumOfTotal()
Dim i As Integer
Dim TotalSlides As Integer
Dim mSlide As Slide
On Error Resume Next
TotalSlides = Application.ActivePresentation.BuiltInDocumentProperties("Number of Slides")

With ActivePresentation.SlideMaster.HeadersFooters
    With .Footer
        .Visible = msoTrue
    End With
    .SlideNumber.Visible = msoFalse
    .DisplayOnTitleSlide = msoFalse
End With

' go to each slide and insert text into 
' footer with...wait for it...
' the builtindocumentproperties("Number of Slides")

For Each mSlide In Application.ActivePresentation.Slides()
    i = mSlide.SlideNumber
    mSlide.Select
    With ActiveWindow.Selection.SlideRange.HeadersFooters
        .DateAndTime.Visible = msoFalse
        .Footer.Text = "Slide " & i & " of " & TotalSlides
    End With
    i = i + 1
Next
End Sub

As stated in my previous post the BuiltinDocumentProperties returns the number of slides in the saved file. To accurately get the footers, save the file, and then run the Sub.

I guess this is more than "a couple of steps". Sorry if I am being verbose. Actually it is not a big deal, it only took a few minutes to figure out. I don't use PowerPoint, but I DO use Word, and have found out that the BuiltinDocumentProperties can be very handy. ALL Office apps have them...the same ones oddly enough. If the app does not actually set a value into a specific one, requesting the return value gives an error...although requesting the name does not. Go figure.

Have fun.

Gerry
 
Ooops. Do not need the line:

i = i + 1

Unneeded, as i is explicitly set in the loop. Doh.

Oh, and this will work regardles of where (or if) you may insert a new slide. It does not matter, as it loops through ALL the slides explicitly writing the footer text for each.

Gerry
 
Almost there, except at the moment I have Slide 2 of 0.

M
 
Ignore that, I didn't save the show (next time I'll RTI properly).
 
Correct. It takes the number of slides from the saved file, which is a BuiltinDocumentProperty.

Gerry
 
Why not use [blue]ActivePresentation.Slides.Count[/blue] instead? This is the current number of slides in the copy being edited.

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
 
Fumei! I have done it, and, it is not quite right. I end up with Slide 3 of 3, Slide 5 of 5...in the same slide show. Are you sure it works? the numbers have been inserted on particular slides when I ran the macro. eg, if I had inserted 3 slides, it is Slide 3 of 3. If I run macro after inserting 5 slides and saving, it says Slide 5 of 5.

So, I don't know about that star now! Mind you, I am a total novice when it comes to macros. I can record them. I can copy someone elses code into a new macro and that's about that...assign icons...so, it may well be my mistake.

After deleting the line you said is not needed: i = i+1...what are the last 4 lines of the macro...?
 
Gee, I didn't know you could take away a star. Oh well.

1. Yes it works. All my tests (dumping in a bunch of slides randomly, every which way). But you have to save the file first, then run the sub. But yes, it works. Sniff, my star is gone....

2. Tony, as usual, is kicking my ass here. Yes, sigh, ActivePresentation.Slides.Count works just as well as
ActivePresentation.BuiltinDocumentProperties("Number of Slides"), and saves (I think) 14 keystrokes.

Gerry
 
Well, it is working. And, I even debugged (to get rid of 2 words and an apostrophe - I have no idea of macro syntax at all)

I notice in the code that there is a sentence:

go to each slide and insert text into
' footer with...wait for it...
' the builtindocumentproperties("Number of Slides")

Macros with "jokes"?

Have a star.

M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top