Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-18-2022, 12:53 AM
NickyB NickyB is offline Page numbering Windows 10 Page numbering Office 2016
Novice
Page numbering
 
Join Date: Sep 2022
Posts: 5
NickyB is on a distinguished road
Post Page numbering

Hello,



I'm facing a problem generating page number of slides and can't find similar topics.
The manual method remains possible but too tedious, especially for future updates...

I'm working on a file in A3 landscape mode in order to make a presentation representing a "book" format with two A4 portrait pages facing each other (I hope that's clear).
So only my front and back pages are in A4 portrait format. For information, these two A4 pages are located in another file which does not interest us here.

I therefore want to make a double numbering of the A3 landscape pages so that they look like 2 A4 pages facing each other like in an open book.
- An even numbering on the left of the slide - for example 2 on the 1st slide;
- An odd numbering to the right of this same slide - for example 3 on the 1st slide;

I know that Powerpoint is not the best software to make this type of document...

This is why I am looking for a VBA allowing me to perform this numbering automatically.

Ideas ?

Thank you !
Reply With Quote
  #2  
Old 09-18-2022, 05:43 AM
JohnWilson JohnWilson is offline Page numbering Windows 10 Page numbering Office 2019
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Maybe something like

Code:
Sub number_Me()

Dim osld As Slide
Dim SW As Long
Dim SH As Long
Dim x As Long
SW = ActivePresentation.PageSetup.SlideWidth
SH = ActivePresentation.PageSetup.SlideHeight
Call Killer ' remove old numbers
For Each osld In ActivePresentation.Slides
With osld.Shapes.AddTextbox(msoTextOrientationHorizontal, 10, SH - 50, 20, 20)
.TextFrame2.TextRange = CStr(osld.SlideIndex + x)
.Name = "Mynumber"
End With
With osld.Shapes.AddTextbox(msoTextOrientationHorizontal, SW - 30, SH - 50, 20, 20)
.TextFrame2.TextRange = CStr(osld.SlideIndex + x + 1)
.Name = "Mynumber"
End With
x = x + 1
Next osld
End Sub

Sub Killer()
Dim osld As Slide
Dim l As Long
For Each osld In ActivePresentation.Slides
For l = osld.Shapes.Count To 1 Step -1
If osld.Shapes(l).Name = "Mynumber" Then osld.Shapes(l).Delete
Next l
Next osld
End Sub
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #3  
Old 09-18-2022, 11:44 AM
NickyB NickyB is offline Page numbering Windows 10 Page numbering Office 2016
Novice
Page numbering
 
Join Date: Sep 2022
Posts: 5
NickyB is on a distinguished road
Default

Hello John,

Wow! thank you very much! That was very fast!
This exactly what I want.

I've only change the numbering (start at 2 because the first page is pair).

I've tried to reduce the size of the text but it is not working when I change "osld.Shapes.AddTextbox" value...

Any idea ?
while awaiting developments, THANK YOU VERY MUCH!
Here the code I modify.

Code:
Sub number_Me()

Dim osld As Slide
Dim SW As Long
Dim SH As Long
Dim x As Long
x = 1 'first page is number 2
SW = ActivePresentation.PageSetup.SlideWidth
SH = ActivePresentation.PageSetup.SlideHeight
Call Killer ' remove old numbers
For Each osld In ActivePresentation.Slides
With osld.Shapes.AddTextbox(msoTextOrientationHorizontal, 20, SH - 45, 20, 20)
.TextFrame2.TextRange = CStr(osld.SlideIndex + x)
.Name = "Mynumber"
End With
With osld.Shapes.AddTextbox(msoTextOrientationHorizontal, SW - 40, SH - 45, 20, 20)
.TextFrame2.TextRange = CStr(osld.SlideIndex + x + 1)
.Name = "Mynumber"
End With
x = x + 1
Next osld
End Sub

Sub Killer()
Dim osld As Slide
Dim l As Long
For Each osld In ActivePresentation.Slides
For l = osld.Shapes.Count To 1 Step -1
If osld.Shapes(l).Name = "Mynumber" Then osld.Shapes(l).Delete
Next l
Next osld
End Sub
Reply With Quote
  #4  
Old 09-18-2022, 12:05 PM
JohnWilson JohnWilson is offline Page numbering Windows 10 Page numbering Office 2019
Programmer
 
Join Date: Nov 2008
Location: UK
Posts: 1,912
JohnWilson has a spectacular aura aboutJohnWilson has a spectacular aura about
Default

Try

Code:
Sub number_Me()

Dim osld As Slide
'change size here
Const fontSZ As Long = 12
Dim SW As Long
Dim SH As Long
Dim x As Long
SW = ActivePresentation.PageSetup.SlideWidth
SH = ActivePresentation.PageSetup.SlideHeight
Call Killer ' remove old numbers
For Each osld In ActivePresentation.Slides
With osld.Shapes.AddTextbox(msoTextOrientationHorizontal, 10, SH - 50, 20, 20)
.TextFrame2.TextRange = CStr(osld.SlideIndex + x + 1)
.TextFrame2.TextRange.Font.Size = fontSZ
.Name = "Mynumber"
End With
With osld.Shapes.AddTextbox(msoTextOrientationHorizontal, SW - 30, SH - 50, 20, 20)
.TextFrame2.TextRange = CStr(osld.SlideIndex + x + 2)
.TextFrame2.TextRange.Font.Size = fontSZ
.Name = "Mynumber"
End With
x = x + 1
Next osld
End Sub

Sub Killer()
Dim osld As Slide
Dim l As Long
For Each osld In ActivePresentation.Slides
For l = osld.Shapes.Count To 1 Step -1
If osld.Shapes(l).Name = "Mynumber" Then osld.Shapes(l).Delete
Next l
Next osld
End Sub
__________________
Microsoft PowerPoint MVP 2007-2023
Free Advanced PowerPoint Tips and Tutorials
Reply With Quote
  #5  
Old 09-18-2022, 01:20 PM
NickyB NickyB is offline Page numbering Windows 10 Page numbering Office 2016
Novice
Page numbering
 
Join Date: Sep 2022
Posts: 5
NickyB is on a distinguished road
Default

WOW!

AMAZING, Thanks very much.

Regards,
Reply With Quote
  #6  
Old 09-19-2022, 09:38 AM
NickyB NickyB is offline Page numbering Windows 10 Page numbering Office 2016
Novice
Page numbering
 
Join Date: Sep 2022
Posts: 5
NickyB is on a distinguished road
Default

One last thing, is it possible to modify the color of the text (put it in white) only for the slides of the master slide named "Titles"?

Regards,
Reply With Quote
Reply

Tags
numbering, slide number, vba

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Page numbering Page-numbering question: continue numbering from one section to the next? {PAGE} of {SECTIONPAGES} SDwriter Word 12 10-25-2017 06:56 AM
Page numbering How to add page numbering after next page break with landscape and portrait Jashley1 Word 2 11-25-2014 10:36 PM
Page numbering begin each section with page 1 in header PLUS continuous page numbering in footer onemorecupofcoffee Word 18 09-04-2013 04:31 PM
Page numbering Parallel page numbering/same page numbers for odd and even pages goran Word 2 11-02-2012 03:42 PM
Page Header and Page Numbering for Technical Book SQLUSA Word 4 06-25-2012 09:53 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:14 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft