Hi all:
I am using EXCEL 2007, and I am trying to change the font size of the 2nd line of a chart title.
I ran a macro using EXCEL 2003 to see how this might be accomplished, but it did not work as it set the font size of the entire chart title to the value that was assigned to the 2nd line of the chart title.
For reference purposes, I am including the Macro that works in EXCEL 2003, but does not work in EXCEL 2007 below.
Any help would be greatly appreciated in providing code that provides 2 different font sizes for a chart title with multiple lines in EXCEL 2007.
Thanks in advance for your help.
VPI63
===========
Sub ChangeChartTitleFontSize ()
'
'EXCEL 2003 Macro (Doesn't work in EXCEL 2007)
'The Macro runs in EXCEL 2007, but sets the Font Size of The chart title to '16, which is Font size of the 2nd line of the chart title
'
Dim ChartTitle1 as string
Dim ChartTitle2 as String
Dim Lenght1 as Integer
Dim Lenght2 as Integer
ChartTitle1 = "This is the First Line With the Large Font"
ChartTitle2 = "This is the 2nd Line"
'
Lenght1 = len(ChartTitle1)
Lenght2 = Len(ChartTitle2)
'
ActiveChart.ChartTitle.Select
Selection.Characters.Text = ChartTitle1 & Chr(10) & ChartTitle2
Selection.AutoScaleFont = False
With Selection.Characters(Start:=1, Length:=Length1).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 24
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
'.ColorIndex = xlAutomatic
End With
Selection.Characters.Text = ChartTitle1 & Chr(10) & ChartTitle2
Selection.AutoScaleFont = False
With Selection.Characters(Start:=Length1 + 1, Length:=Length2).Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 16
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
End sub
Bookmarks