Supercharge your PowerPoint productivity with

Supercharge your PPT Productivity with PPTools - Click here to learn more.

Tell me about PPTools

Make subscripts and superscripts larger


PPTools
Shape Styles brings the power of styles to PowerPoint. Apply complex formatting with a single click
Merge Excel, CSV or tab-delimited data into PowerPoint presentations to create certificates, awards presentations, personalized presentations and more
FixLinks prevents broken links when you distribute PowerPoint presentations
Optimizer saves disk space and bandwidth, shrinks your PowerPoint presentations to the right size for email, screenshow or printing
PPT2HTML gives you full control of PowerPoint HTML output, helps meet Section 508 accessibility requirements
Prep4PDF preserves interactivity in PowerPoint presentations when you convert to PDF
Image Export converts PowerPoint slides to JPG, PNG, GIF, WMF and more

Problem

You'd like to make the subscripts and superscripts in your text larger than the default size.

Solution

This VBA routine looks at each "run" of text in each shape on each slide in the presentation. A run of text is a character or group of characters that's differently formatted from the previous character or group of characters.

If the current run's baseline offset is not zero then it's a subscript. The macro looks at the size of the previous run and makes this run's text larger by a set amount (the value you set as dBumpBy below).

You could also make dBumpBy negative if you want to make the sub/superscripts smaller.


Sub BumpTheSubsAndSupers()

Dim oSl As Slide
Dim oSh As Shape
Dim x As Long
Dim dBumpBy As Double

dBumpBy = 4 ' number of points to bump sub/superscript by
' Check each slide
For Each oSl In ActivePresentation.Slides
  ' Check each shape on the slide
  For Each oSh In oSl.Shapes
    ' Make sure it's got text
    If oSh.HasTextFrame Then
      If oSh.TextFrame.HasText Then
        With oSh.TextFrame.TextRange
          For x = 1 To .Runs.Count
            If .Runs(x).Characters.Font.BaselineOffset <> 0 Then
            ' it's a sub/super; make it four points
            ' bigger than the text immediately prior:
            .Runs(x).Characters.Font.Size = _
               .Runs(x - 1).Characters.Font.Size + dBumpBy
        End If  ' it's a sub/superscript
      Next x
    End With    ' textframe.textrange
      End If    '  .HasText
    End If  '  .HasTextFrame
  Next oSh      '
Next oSl

End Sub

See How do I use VBA code in PowerPoint? to learn how to use this example code.

Search terms:subscript,superscript,larger,smaller


Page copy protected against web site content infringement by Copyscape Contents © 1995-2008 Stephen Rindsberg, Rindsberg Photography, Inc. and members of the MS PowerPoint MVP team. You may link to this page but any form of unauthorized reproduction of this page's contents is expressly forbidden.

Español    Deutsch    Français    Português    Italiano    Nederlands    Greek    Japanese    Korean    Chinese



Supercharge your PPT Productivity with PPTools


content authoring & site maintenance by
Friday, the automatic faq maker (logo)
Friday - The Automatic FAQ Maker

Make subscripts and superscripts larger
http://www.pptfaq.com/FAQ00635.htm
Last update 09 September, 2006