Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using VBA to Dynamically Format MS Graph in reports

Status
Not open for further replies.

BruceWMoore

Programmer
Jun 29, 2003
6
US
in thread703-1492459, there was a discussion of changing the color of a column. I needed to change the color of the points on a graph in MS Access based on comparing the data for the various series.

I had to do what was suggested in that thread. I set a reference to the "Microsoft Graph 11.0 Object Library", and then I was able to refer to the same objects that I had already written MS Excel VBA code for (in an Excel version of the same chart).

An abbreviated version of my working code is as follows:

Code:
 Dim PctCht As Chart
 Dim pt As Point
 Set PctCht = SieveTestChart.Object.Application.Chart
 
 'initialize things to a normal look
 For Each pt In PctCht.SeriesCollection("RetainedWgtPct").Points
  pt.MarkerBackgroundColorIndex = 5
  pt.MarkerForegroundColorIndex = 1
  pt.HasDataLabel = False
 Next

This was on a chart which was created using the chart wizard in Access, and was embedded in an MS Access report.

thread703-1492459 helped me get there.
Thanks!

Bruce W. Moore
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top