How to add a title to a chart by means of Excel automation?

  • Thread starter Thread starter dotNeter
  • Start date Start date
D

dotNeter

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.
 
After applying the source data and before applying the title text

objChart.HasTitle = True

Regards,
Peter T
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top