ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to add a title to a chart by means of Excel automation? (https://www.excelbanter.com/excel-programming/377735-how-add-title-chart-means-excel-automation.html)

dotNeter

How to add a title to a chart by means of Excel automation?
 
It's easy when using VBA code, like,
..ChartTitle.Characters.Text = "Hello"

But, setting a Text or Characters property of chartTitle always got an
exception. Is it possible doing that?

code excerpt in vb.net

objChart = objSheet.ChartObjects.Add(50, 40, 300, 200).Chart
objChart.SetSourceData(Source:=objSheet.Range("A1" ).Resize(cNumRows,
cNumCols))
objChart.ChartTitle.Characters.Text = "Hello" <---- here!!!

Thx in advance.


Peter T

How to add a title to a chart by means of Excel automation?
 
After applying the source data and before applying the title text

objChart.HasTitle = True

Regards,
Peter T

"dotNeter" wrote in message
ups.com...
It's easy when using VBA code, like,
.ChartTitle.Characters.Text = "Hello"

But, setting a Text or Characters property of chartTitle always got an
exception. Is it possible doing that?

code excerpt in vb.net

objChart = objSheet.ChartObjects.Add(50, 40, 300, 200).Chart
objChart.SetSourceData(Source:=objSheet.Range("A1" ).Resize(cNumRows,
cNumCols))
objChart.ChartTitle.Characters.Text = "Hello" <---- here!!!

Thx in advance.





All times are GMT +1. The time now is 12:25 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com