I can't believe that someone hasn't figured this out! After a long
afternoon of playing around, I discovered that Graph.Chart 8.0 doesn't
like a Record Source on the Report. If you're assigning a Record
Source in the OnOpen Event...Remove that to. Everything works after
that.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
1 On Error GoTo Err_dF
5 Dim chr As Graph.Chart
10 Dim j As Integer
15 Dim X As String
20 Set chr = myChart.Object
25 With chr.Legend
30 j = .LegendEntries.Count
35 For i = 1 To j
40 X = .Application.DataSheet.Cells(i + 1, 1)
45 Select Case X
Case "Actual"
50 .LegendEntries(i).LegendKey.Interior.Color = 0
Case "PM/Engr."
55 .LegendEntries(i).LegendKey.Interior.Color =
32768
Case "Equip"
60 .LegendEntries(i).LegendKey.Interior.Color =
65535
Case "Matl"
65 .LegendEntries(i).LegendKey.Interior.Color =
16711680
Case "Merit"
70 .LegendEntries(i).LegendKey.Interior.Color =
39423
Case "JEG_SC"
75 .LegendEntries(i).LegendKey.Interior.Color =
255
Case "BPMISC"
80 .LegendEntries(i).LegendKey.Interior.Color =
16763904
Case "BP_SC"
85 .LegendEntries(i).LegendKey.Interior.Color =
13209
Case "Conting"
90 .LegendEntries(i).LegendKey.Interior.Color =
16751052
Case "UN"
95 .LegendEntries(i).LegendKey.Interior.Color =
RGB(255, 255, 255)
100 End Select
105 Next
110 End With
Exit_dF:
115 Exit Sub
Err_dF:
120 If Err.Number = 1004 Then
125 Resume Next
130 Else
135 MsgBox Err.Number & " " & Err.Description & chr(13) &
chr(10) & "Detail Format Line No: " & Erl
140 Resume Exit_dF
145 End If
End Sub
Da**********@SBCGlobal.Net (Dave) wrote in message news:<8c*************************@posting.google.c om>...
I'm trying to follow the examples in VBAGRP9.CHM and/or VBAGR10.CHM with no
success. I'm trying to Chage the Legend Colors based on Content so that I
can establish a certain color format on Content. The Chart will reside on a
Report and possibly converted to a 2002 format. Currently I'm using the
following code with Microsoft Graph 11.0 Object Library referenced.:
With myChart.Legend
For i = 1 To .LegendEntries.Count
.LegendEntries(i).Font.ColorIndex = 5
Next
End With
The Errors that I'm getting are either:
2771 The bound or unbound object frame you triedto edit doesn't contain an
OLE object.
or
438 Object doesn't support this property or method.
Please help me Master(s), so that I can justify my existance.