|
-
Oct 4th, 2010, 04:46 AM
#1
Thread Starter
Member
[RESOLVED] Excel Chart Text Size
Hey guys,
I have written a bit of code to create a stackedbar100 chart on a new excel worksheet. It is created correctly, as are all labels/titles on screen. The only problem is that the text is a bit to small, and I wish for it to be bigger. Is there are simple way of increasing the text size of the entire chart? I have noted that in Excel when you right click on the chart itself, the font option there changes the font for all text within the chart. I tired recording a macro of the action but it does not provide any real information.
Is there a simple call I am missing somewhere? Here is my code to create the chart.
Code:
Dim ChartSheet As excel.Worksheet
ChartSheet = wb.Sheets.Add
ChartSheet.Name = "Cluster Chart"
Dim chartpage As excel.Chart
Dim xlcharts As excel.ChartObjects
Dim mychart As excel.ChartObject
Dim chartrange As excel.Range = PivotSheet.UsedRange
xlcharts = ChartSheet.ChartObjects
mychart = xlcharts.Add(10, 80, 1000, 500)
chartpage = mychart.Chart
chartpage.SetSourceData(chartrange)
chartpage.ChartType = excel.XlChartType.xlBarStacked100
chartpage.Legend.Position = excel.XlLegendPosition.xlLegendPositionBottom
chartpage.ApplyDataLabels(excel.XlDataLabelsType.xlDataLabelsShowValue)
For i = 1 To chartpage.SeriesCollection.count
Select Case i
Case 1
chartpage.SeriesCollection(i).interior.color = RGB(127, 255, 0)
Case 2
chartpage.SeriesCollection(i).interior.color = RGB(255, 255, 0)
Case 3
chartpage.SeriesCollection(i).interior.color = RGB(255, 165, 0)
Case 4
chartpage.SeriesCollection(i).interior.color = RGB(255, 0, 0)
Case Else
chartpage.SeriesCollection(i).interior.color = RGB(255, 255, 255)
End Select
Next
-
Oct 4th, 2010, 04:52 AM
#2
Re: Excel Chart Text Size
try like
chartpage.chartarea.font.size = 16
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 4th, 2010, 04:59 AM
#3
Thread Starter
Member
Re: Excel Chart Text Size
 Originally Posted by westconn1
try like
chartpage.chartarea.font.size = 16
I love you. Exactly what I needed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|