PDA

View Full Version : Max length of a Chart Title.



colene
11-20-2008, 11:56 PM
I am using VBA to have dynamic multiline chartline ..it throws me error when the third line is more than 80 characters ..

my Line1 has 50 characters
Line2 - 100 characters
Line 3 till 80 ..Iam able to get ..When it exceeds i get error
mytitle = line1 & Chr(10) & line2 & projDet & sapDet & apDet & meDet & Chr(10) & filterdet
Set chtChart = Charts(1)
With chtChart.ChartTitle
.Text = mytitle
.Characters(0, Len(line1)).Font.Size = 12
.Characters(Len(line1) + 1, Len(mytitle)).Font.Size = 10
'.Characters(0,Len(line1)).Font.Color = 66
End With

Andy Pope
11-21-2008, 04:14 AM
Max length is 255, including explicit line feeds.

ErikL
11-22-2016, 08:31 AM
I know this is an old thread, but I just found that the 255 character limit can be exceeded (with Excel 2007+) if using

.ChartTitle.Format.TextFrame2.TextRange.Characters.Text
instead of

.ChartTitle.Text
I haven't found the limits of this increased capacity - it may not have one - but I basically filled my chart with the title trying to find it, so it must be huge (4096?).

ErikL
11-22-2016, 08:58 AM
Argh - false alarm. It turns out that characters past 255 are LOST on file save, at least on Excel 2016 when saving to an XLSX file. This despite Microsoft claiming the 255 character limit only applies to Excel before 2007.