[AccessD] MS Graph - Change Chart Title by Automation?

Dan Waters dwaters at usinternet.com
Mon Jun 28 07:43:33 CDT 2004


Chester,

I spent several hours finding and reading MS KB article over the last few
days and was able to get this to work.  What I didn't see though that you
have here is the use of rpt(i).OLEClass to determine what the object of an
unbound frame actually is.

In a day or so I'll send a note to describe how I did get this to work.

Thanks!
Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Kaup, Chester A
Sent: Monday, June 28, 2004 7:33 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] MS Graph - Change Chart Title by Automation?

Here is something I did in an older access 97 database to programically
change the axis of a graph. Might give you a place to start.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim Db As Database, rs As Recordset
Dim i As Integer, intCnt As Integer, ChartName As String
Dim rpt As Report, FinalDate As Date

Set Db = CurrentDb()
'add 7 days to todays date
FinalDate = Date + 7
Set rpt = Reports("Section 6 West and Section 1 East")
'Count the number of controls
intCnt = rpt.Count
    
For i = 0 To intCnt - 1
    Select Case rpt(i).ControlType
            Case acLabel
            Case acRectangle
            Case acLine
            Case acImage
            Case acCommandButton
            Case acOptionButton
            Case acCheckBox
            Case acOptionGroup
            Case acBoundObjectFrame
            Case acTextBox
            Case acListBox
            Case acComboBox
            Case acSubform
            Case acObjectFrame
                'Stop
                If rpt(i).OLEClass = "Microsoft Graph 97 Chart" Then
                    ChartName = rpt(i).Name
 
rpt.Controls(ChartName).Object.Application.Chart.Axes(1).MaximumScale =
FinalDate
                End If
            Case acPageBreak
            Case acPage
            Case acCustomControl
            Case acToggleButton
            Case acTabCtl
            Case Else
                'Stop
                If rpt(i).OLEClass = "Microsoft Graph 97 Chart" Then
                    ChartName = rpt(i).Name
 
rpt.Controls(ChartName).Object.Application.Chart.Axes(1).MaximumScale =
FinalDate
                End If
    End Select
NoChart:
Next i

End Sub
Chester Kaup
Information Management Technician
IT-MidContinent/MidContinent Business Unit
CTN 8-687-7415  
Outside 432-687-7414

No trees were killed in the sending of this message. However a large
number of electrons were terribly inconvenienced. 




-----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


-- 
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list