PDA

View Full Version : Solved: chart titles with varied font sizes



colene
09-29-2008, 11:01 PM
I do create a 2 line chart titly thru VBA ..Now i want to have a bigger font size for line 1 than line 3.how can i do this

Set chtChart = Charts(1)
chtChart.ChartTitle.Text = line1 & Chr(10) & line2

Bob Phillips
09-30-2008, 01:32 AM
Set chtChart = ActiveSheet.ChartObjects(1).Chart
With chtChart.ChartTitle
.Text = line1 & Chr(10) & line2
.Characters(7, 6).Font.Size = 16
End With

colene
09-30-2008, 02:21 AM
Thanks a lot ..Works great

colene
10-01-2008, 12:36 AM
Set chtChart = Charts(1)
With chtChart.ChartTitle
.Text = mytitle
'to increase the font size of line 1
.Characters(0, Len(line1)).Font.Size = 14
End With
The solution is fine when i activate the chart for the first time .but when i switch back to the sheet and come to the chart again ..all the lines have the font size as of Line 1

Bob Phillips
10-01-2008, 01:46 AM
I don't get this problem. Your code looks wrong to me as well, wat platform are you on?

colene
10-01-2008, 02:35 AM
Iam using M/S office Professional edition 2003 on XP professional .Also the chart is there as new sheet and not as a object of the sheet which has the table


mytitle = line1 & Chr(10) & line2 & projDet & Chr(10) & filterDet
Set chtChart = Charts(1)
With chtChart.ChartTitle
.Text = mytitle
'to increase the font size of line 1
.Characters(0, Len(line1)).Font.Size = 14
End With

colene
10-01-2008, 02:42 AM
With chtChart.ChartTitle
.Text = mytitle
'to increase the font size of line 1
.Characters(0, Len(line1)).Font.Size = 14
.Characters(Len(line1) + 1, Len(mytitle)).Font.Size = 12
End With

i did so then it seems good for me