B
BoJosley
I have a problem superscripting characters in Excel 2007 Text Boxes. What's
strange is that I have no problem subscripting characters in Excel 2007 nor
do I have a problem with superscripts in Excel 2003.
Here are two simple macros one for superscripts and subscripts.
Sub Superscript()
' WORKS IN EXCEL 2003 NOT IN EXCEL 2007
Application.CommandBars("Drawing").Visible = True
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 117#, 60#, _
117.75, 63.75).Select
Selection.Characters.Text = "hello"
With Selection.Characters(Start:=1, Length:=4).Font
.Name = "Comic Sans MS"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Characters(Start:=5, Length:=1).Font
.Name = "Comic Sans MS"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = True
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("E12").Select
End Sub
Sub Subscript()
' WORKS IN Both EXCEL 2003 AND EXCEL 2007
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 115.5, 162#, _
127.5, 89.25).Select
Selection.Characters.Text = "hello"
With Selection.Characters(Start:=1, Length:=1).Font
.Name = "Comic Sans MS"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Characters(Start:=2, Length:=1).Font
.Name = "Comic Sans MS"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = True
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Characters(Start:=3, Length:=3).Font
.Name = "Comic Sans MS"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("F21").Select
End Sub
strange is that I have no problem subscripting characters in Excel 2007 nor
do I have a problem with superscripts in Excel 2003.
Here are two simple macros one for superscripts and subscripts.
Sub Superscript()
' WORKS IN EXCEL 2003 NOT IN EXCEL 2007
Application.CommandBars("Drawing").Visible = True
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 117#, 60#, _
117.75, 63.75).Select
Selection.Characters.Text = "hello"
With Selection.Characters(Start:=1, Length:=4).Font
.Name = "Comic Sans MS"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Characters(Start:=5, Length:=1).Font
.Name = "Comic Sans MS"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = True
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("E12").Select
End Sub
Sub Subscript()
' WORKS IN Both EXCEL 2003 AND EXCEL 2007
ActiveSheet.Shapes.AddTextbox(msoTextOrientationHorizontal, 115.5, 162#, _
127.5, 89.25).Select
Selection.Characters.Text = "hello"
With Selection.Characters(Start:=1, Length:=1).Font
.Name = "Comic Sans MS"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Characters(Start:=2, Length:=1).Font
.Name = "Comic Sans MS"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = True
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
With Selection.Characters(Start:=3, Length:=3).Font
.Name = "Comic Sans MS"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("F21").Select
End Sub