Dan Waters
dwaters at usinternet.com
Mon Jun 28 17:24:39 CDT 2004
Well, after searching through a number of MSKB articles, I got this to work.
Turns out that with A2K and up you can use early binding, which is nice.
Example code is below:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo EH
Dim cht As Graph.Chart
Set cht = Me.OLEUnboundFrame.Object
cht.HasTitle = True
cht.ChartTitle.Text = "Different Title"
Set cht = Nothing
Exit Sub
EH:
Application.Echo True
'call error handling
End Sub
KB article 201710 was key. Article 244589 & 222689 were helpful. Also, you
may have two help files on your PC which provide complete reference to the
MS Graph object model. These are: GRAPH10.CHM and VBAGR10.CHM (or 9.CHM).
Now, to let users define the data for these charts once they are set up you
will need to modify the query or SQL string (in the row source property of
the unbound object frame) in code before you open the report or form where
the object frame is located. You can create a new form/report using the
chart wizard to develop sample query SQL, and then modify as needed.
I updated a customer's system this morning with a couple of charts where
they can determine date range and a couple of other parameters (like TOP),
and they're pretty happy.
Best of luck!
Dan
-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Friday, June 25, 2004 6:20 PM
To: Database Advisors
Subject: [AccessD] MS Graph - Change Chart Title by Automation?
Struggling for hours . . .
I have an MS Graph 10 chart in an unbound object frame in a report. I also
have the rowsource query correct.
But when the report is opened to display the chart, I need to change the
.Text property of the .ChartTitle.
The unbound object frame is named graChart.
I thought that something like this would work:
Dim gra As Object
Set gra = GetObject(, "MSGraph.Chart.10")
'-- I need something like: _
gra.ChartTitle.Text = "Different Chart Title"
I know this is an automation issue, and I'm trying to manipulate an object
which is in an unbound object frame.
Can anyone send me an example of how you do this?
Thanks!
Dan Waters
--
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com