Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > VBA / Office Integration > Word, PowerPoint, Outlook, and Other Office Products > MS Graph problem


Reply
 
Thread Tools Display Modes
  #1  
Old 05-05-2005, 02:43 AM
ahilton ahilton is offline
Newcomer
 
Join Date: Mar 2004
Posts: 5
Default MS Graph problem


Hi

I'm populating a load (c 200 each month) of MS Graphs in a PPT with data from a XLS. So far so easy. The number of data points varies from graph to graph and increments each month. Each graph is a simple line graph, with only the last datapoint having a data label. I thought I would write something that would go to the graph, remove the label from the last data point, insert new data, then add datalabels to the new last datapoint.

But, whilst the following code works (but is only useful if there are alwys only 6 datapoints)
Code:
With oGraph.SeriesCollection(1).Points(6) .HasDataLabel = False End With
this code produces OBJECT REQUIRED error on the second line
Code:
With oGraph.SeriesCollection(1).Points.Count .HasDataLabel = False End With

Can anyone assist?

Last edited by herilane; 05-05-2005 at 05:04 AM. Reason: [vb] tags make your code easier to read - click Reply on this post to see them in action.
Reply With Quote
  #2  
Old 05-05-2005, 05:06 AM
herilane's Avatar
herilane herilane is offline
Unashamed geek

Retired Moderator
* Expert *
 
Join Date: Jul 2003
Location: London, England
Posts: 8,988
Default

Is this what you're looking for?
Code:
'remove label from last point With oGraph.SeriesCollection(1).Points .Items(.Count).HasDataLabel = False End With

PS I edited your post to add [vb][/vb] tags around your code. More about tags here.
Reply With Quote
  #3  
Old 05-06-2005, 02:20 AM
ahilton ahilton is offline
Newcomer
 
Join Date: Mar 2004
Posts: 5
Default

Thanks, Helen, but no joy. OBJECT DOESN'T SUPPORT THIS PROPERTY OR METHOD.
However I had a look at the Graph Object model and found and came up with this

[vb]Set Points = oGraph.SeriesCollection(1).Points
Points(Points.Count).HasDataLabel = False[\vb]

Thanks agin anyway
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->