Re: Chart Property (e.g.: .HasTitle) reset fails with run-time err
- From: "Peter T" <peter_t@discussions>
- Date: Wed, 16 Jul 2008 20:24:44 +0100
It may be right, but it is definitely not proper.
I like it!
I'll file it with "The customer is always right but the customer is not
always correct"
It is also both arbitrary and counterintuitive, and I am curious
as to how you would know this.
There are many things about the Excel chart object and how it is exposed to
VBA which are, for want of a better word, odd. The one you have picked up on
I'd describe as no more than a quirk.
Regards,
Peter T
"Joseph Felcon" <JosephFelcon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:393450C4-C435-42A1-AD13-150F22048B2F@xxxxxxxxxxxxxxxx
Sir,works,
Thanks for the information. I was unaware that one had to put data into a
chart before being able to add a title to it. I have tried it and it
but I don't like it.is
This is a hidden "feature" (so typical of our friends at MS), because it
nowhere stated in the documentation. It also violates several principlesof
object oriented design to tie together unrelated properties in this way,Turning
especially when the owned objects, themselves, have a property of the same
name. It may be right, but it is definitely not proper. It is also both
arbitrary and counterintuitive, and I am curious as to how you would know
this.
As for your comments about the code, I think that you misread. The
worksheet objects have distinct names (one is Fuel and one is Flow).
off Alerts relieves my customers from seeing a lot of messages aboutinternal
ops and having to click OK a few hundred times, while seeing screenupdates
under the driver form is a positive, because it gives them a sense ofone
activity (i.e.: that something is actually happening while they wait).
Thanks again for information. It works and I will keep it in mind while
working with this, or similar, Excel objects, but I still think that it is
improper.
Joseph A. J. Felcon
"Peter T" wrote:
Are you sure you are doing
' add data to chart for Fuel
chFuel.HasTitle = True
If instead you are actually doing
'no series added yet
chFuel.HasTitle = True
' add data to chart for Fuel
would be one reason why doing HasTitle = true fails. IOW add at least
(allseries first.
In passing I don't follow how you are adding multiple sheets like this
deletingwith same name?)
Set wsChartFuel = Worksheets.Add
wsChartFuel.Name = "Chart Usage"
also can't think why you'd need to disable DisplayAlerts (unless
messagesheets) though you may well want to disable screenupdating
Regards,
Peter T
"Joseph Felcon" <JosephFelcon@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
for anews:746BF76D-22BB-4061-906A-B64B7C84F2F8@xxxxxxxxxxxxxxxx
Hello,
I am getting a run-time 1004 error when trying to program properties
invokingchart. Actually, it is the second chart which I create which is
1004the error message.worksheet
I am creating multiple worksheets, each with one chart. The first
and chart work fine, but the second and third worksheet/chart cause
....errors on certain property values...
' create a new worksheet for chart flow
Application.DisplayAlerts = False
Set wsChartFlow = Worksheets.Add
wsChartFlow.Name = "Chart Flow"
' create the chart flow object
Set coFlow = wsChartFlow.ChartObjects.Add(0, 0, 800, 600)
coFlow.Name = "Net Flow over Time"
Set chFlow = coFlow.Chart
Application.DisplayAlerts = True
' add data to chart for Flow
chFlow.HasTitle = True
chFlow.ChartTitle.Caption = "Net Flow over Time"
chFlow.ChartType = xlXYScatterLines
chFlow.PlotBy = xlColumns
... HEREIN I ADD SERIES AND GENERALLY FORMAT THE CHART TO MY LIKING
m_iSelected,... I ORIGINALLY TRIED ...
' create a new worksheet for chart fuel
Application.DisplayAlerts = False
Set wsChartFuel = Worksheets.Add
wsChartFuel.Name = "Chart Usage"
' create the chart fuel object
Set coFuel = wsChartFuel.ChartObjects.Add(0, 0, 5 * iCopy *
1004'S,600)
coFuel.Name = "Fuel Use over Time"
Set chFuel = coFuel.Chart
Application.DisplayAlerts = True
' add data to chart for Fuel
chFuel.HasTitle = True
chFuel.ChartTitle.Caption = "Fuel Use over Time"
chFuel.ChartType = xlColumnClustered
chFuel.PlotBy = xlColumns
... IN THIS SEQUENCE, .HasTitle AND .ChartTitle.Caption GENERATE
IBUT
THE .ChartType AND .PlotBy PROPERTIES WORK JUST FINE.
I tried adding chFuel.Activate and received a 1004 for my trouble; so
coFuel.Activate),tried wsChartFuel.Activate (the sheet) and
wsChartFuel.ChartObjects(1).Activate (and the equivalent
theall of which work perfectly well, but still don't let me set any of
evenproblematic chart properties.error
Being able to set some properties of the "chart" and getting a runtime
when trying to set others is really most annoying. In fact, I cannot
theremodify these properties in the debug "watches" window (I get 1004
too).
Any help would be greatly appreciated.
Joseph A. J. Felcon
.
- Follow-Ups:
- Re: Chart Property (e.g.: .HasTitle) reset fails with run-time err
- From: Joseph Felcon
- Re: Chart Property (e.g.: .HasTitle) reset fails with run-time err
- References:
- Chart Property (e.g.: .HasTitle) reset fails with run-time error 1
- From: Joseph Felcon
- Re: Chart Property (e.g.: .HasTitle) reset fails with run-time error 1
- From: Peter T
- Re: Chart Property (e.g.: .HasTitle) reset fails with run-time err
- From: Joseph Felcon
- Chart Property (e.g.: .HasTitle) reset fails with run-time error 1
- Prev by Date: Insert line in first row of CSV text file with VBA
- Next by Date: Re: Multiple Office Versions
- Previous by thread: Re: Chart Property (e.g.: .HasTitle) reset fails with run-time err
- Next by thread: Re: Chart Property (e.g.: .HasTitle) reset fails with run-time err
- Index(es):
Relevant Pages
|