问题
I'm working with VBA trying to make charts. The chart is created like it should, but when I try to define a title, I get this error: "run time error '-2147024809 (80070057): this object has no title."
my VBA line is:
ActiveChart.ChartTitle.Text = "From " & Cells(Start, Prev) & " To " & Cells(Start, Op) & " - Recomended Setup: 0"
Does anyone has any idea why It's not working? (the same line worked on another chart already...) Thank you!
回答1:
That is because you need to create the title before you can set it. Add this line before your code
ActiveChart.HasTitle = True
ActiveChart.ChartTitle.Text = "From " & Cells(Start, Prev) & _
" To " & Cells(Start, Op) & _
" - Recomended Setup: 0"
来源:https://stackoverflow.com/questions/25789077/excel-chart-has-no-title-error