Search code examples
ms-officepowerpointslidepresentation

Hexadecimal Slide Numbers in PowerPoint


Is it possible to have my power point slides numbered in hexadecimal? I know it sounds crazy, but I wanted to give a substile nerdy feel to it.


Solution

  • You couldn't have PPT do this for you automatically, but you could run a little code that adds a text box to each slide and in the text box, put the slide's number, converted to hex.

    Something like so:

    Dim oSl as Slide
    Dim oSh as Shape
    
    For each oSl in ActivePresentation.Slide
      Call DeleteHexNumber(oSl)
      ' change coordinates to suit:
      Set oSh = oSl.Shapes.AddTextbox(msoTextOrientationHorizontal,10,10,200,50)
      Osh.Tags.Add "HexNumber", "Whatever"
      With oSh.TextFrame.TextRange
        .Text = Cstr(Hex(oSl.SlideNumber))
      End With
    Next
    
    Sub DeleteHexNumber(oSl as Slide)
      Dim oSh as Shape
      Dim x as Long 
      For x = oSl.Shapes.Count to 1 Step -1
        if Len(oSl.Shapes(x).Tags("HexNumber")) > 0 Then
            oSl.Shapes(x).Delete
        End If
      Next
    End Sub
    

    As edited: Now it tags the page number shape when it creates it but before it creates it, it looks for any existing page number shapes (by checking for matching tags) and deletes them first.