ACC2000: How to Use Automation to Modify MS Graph ObjectID: Q202147
|
This article describes how to use Automation to add or remove a title of a graph and how to hide or show a legend for a graph.
CAUTION: Following the steps in this example will modify the sample
database Northwind.mdb. You may want to back up the Northwind.mdb file
and perform these steps on a copy of the database.
NOTE: To use the Visual Basic for Applications procedures in this article, you must have a reference to Microsoft Graph 9.0 Object Library.
Microsoft provides programming examples for illustration only, without warranty
either expressed or implied, including, but not limited to, the implied warranties of
merchantability and/or fitness for a particular purpose. This article assumes that you
are familiar with the programming language being demonstrated and the tools used to
create and debug procedures. Microsoft support professionals can help explain the functionality
of a particular procedure, but they will not modify these examples to provide added
functionality or construct procedures to meet your specific needs. If you have limited
programming experience, you may want to contact a Microsoft Certified Solution Provider
or the Microsoft fee-based consulting line at (800) 936-5200. For more information about
Microsoft Certified Solution Providers, please see the following page on the World Wide Web:
http://www.microsoft.com/mcsp/For more information about the support options available from Microsoft, please see the following page on the World Wide Web:
http://www.microsoft.com/support/supportnet/overview/overview.asp
Command Button
--------------
Name: Title
Caption: Toggle Caption
Sub Title_Click()
'-------------------------------------------------------
' Show or hide the title by using the Not Operator to
' reverse the state of the HasTitle property
'-------------------------------------------------------
Me!Graph1.Hastitle = Not Me!Graph1.Hastitle
' If the graph has a title, set the Caption to something
If Me!Graph1.Hastitle Then
Me!Graph1.ChartTitle.Text = "Sample Title"
End If
End Sub
Option Explicit
Command Button
----------------------
Name: Legend
Caption: Toggle Legend
Sub Legend_Click ()
'-----------------------------------------------------------
' If the legend is not present, show it; otherwise, hide it.
' Use the Not Operator to reverse the state of the HasLegend
' property of the graph.
'-----------------------------------------------------------
Me!Graph1.Haslegend = Not Me!Graph1.Haslegend
End Sub
Option Explicit
For more information about Automation, click Microsoft Access Help on the
Help menu, type "understanding automation" in the Office Assistant or the Answer Wizard,
and then click Search to view the topic.
Additional query words: link embed
Keywords : kbole kbdta kbgraph
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto
Last Reviewed: July 6, 1999