Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Chart DataLabel Placement Error

Im changing DataLabels on a charts line series and keep running into the
same problem. Ive Googled
around but cant find anything that solves this. On the marked line I get
the following error:

Err = -2147467259
Description: Method 'Top' of object 'DataLabel' failed

Jon Peltier has a fine answer in this group 9/4/2008. Although loading the
code with DoEvents
and Application.ScreenUpdating = True avoids that error (the On Error
statements do not get invoked), the
result is that the labels do not get moved at all. In addition, The problem
shows up while running in real
time (F5 speed) only. That is, when I stop and use the debugger and step
through the code, it works fine.

Any ideas how to stop this error?



'All points in Charts("MonthlyChart").SeriesCollection("Users") are valid.
Dim whichUser As Long
For whichUser = 1 To numberOfUsers


Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).HasDataLabel = True

Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.Text = Worksheets("UserTable").Cells(whichUser, 1).Text


Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.Orientation = xlUpward

Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.VerticalAlignment = xlVAlignBottom

Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.HorizontalAlignment = xlHAlignLeft

Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.Font.Size = 9

Application.ScreenUpdating = False
DoEvents
Charts("MonthlyChart").Refresh
DoEvents

Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.Top = 200 '<--- Crash here.
DoEvents

Next whichUser
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 461
Default Chart DataLabel Placement Error

If you can avoid the errors by use of DoEvents, etc., you can then try
to repeat the step that relocates the labels, or rerun the whole procedure.

- Jon
-------
Jon Peltier
Peltier Technical Services, Inc.
http://peltiertech.com/



George Lee wrote:
Im changing DataLabels on a charts line series and keep running into the
same problem. Ive Googled
around but cant find anything that solves this. On the marked line I get
the following error:

Err = -2147467259
Description: Method 'Top' of object 'DataLabel' failed

Jon Peltier has a fine answer in this group 9/4/2008. Although loading the
code with DoEvents
and Application.ScreenUpdating = True avoids that error (the On Error
statements do not get invoked), the
result is that the labels do not get moved at all. In addition, The problem
shows up while running in real
time (F5 speed) only. That is, when I stop and use the debugger and step
through the code, it works fine.

Any ideas how to stop this error?



'All points in Charts("MonthlyChart").SeriesCollection("Users") are valid.
Dim whichUser As Long
For whichUser = 1 To numberOfUsers


Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).HasDataLabel = True

Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.Text = Worksheets("UserTable").Cells(whichUser, 1).Text


Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.Orientation = xlUpward

Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.VerticalAlignment = xlVAlignBottom

Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.HorizontalAlignment = xlHAlignLeft

Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.Font.Size = 9

Application.ScreenUpdating = False
DoEvents
Charts("MonthlyChart").Refresh
DoEvents

Charts("MonthlyChart").SeriesCollection("Users").P oints(whichUser).DataLabel.Top = 200 '<--- Crash here.
DoEvents

Next whichUser

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
DataLabel.Font.ColorIndex vs DataLabel.Text (Private Sub does not work in excel 2003) God Itself Charts and Charting in Excel 4 April 22nd 09 03:40 PM
DataLabel.Font.ColorIndex vs DataLabel.Text (Private Sub does not work in excel 2003) God Itself Excel Programming 0 April 22nd 09 10:11 AM
I have a bar chart and i want to horizontaly align the datalabel charles Charts and Charting in Excel 1 August 12th 06 01:26 AM
Adding a Chart Datalabel with a Webding John Michl Excel Programming 2 January 5th 06 03:43 PM
Edit datalabel positions in a protected chart Joy Charts and Charting in Excel 1 June 13th 05 08:18 PM


All times are GMT +1. The time now is 03:02 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"