Thread: [Solved] Page numbering
View Single Post
 
Old 09-18-2022, 12:05 PM
JohnWilson JohnWilson is offline Windows 10 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