How to get MSChart as parameter?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I want to create a sub with MSChart as parameter. I've the following lines
of code:

Sub test(ch as MSChart)
...
end sub

However, compiling causes the error "User-defined type not defined".

What can I do? Using MS Access 2000.
Thanks for help
 
Hi,
I think you have to add reference to Microsoft chart library, menu
tools-references
 
Thanks, Alex.
I've added the reference (now I see also the MSChart in the pop-up lists).
But now I think my real question is another: I've dropped a "Microsoft Chart
Control 6.0" on my form. And this is the one I want as parameter.

The call Test(myChartControl) doesn't work. And also

Dim fig as MSChart
Set fig = myChartControl

gives an error: Type Mismatch.

Dim fig as MSChart
Set fig = myChartControl.Object

runs correct, but the call Test(myChartControl.Object) gives the error
"Object Required".

In the properties of myChartControl I see:
OLE Class: MSChart
Class: MSChart20Lib.MSChart.2
but replacing MSChart by MSChart20Lib.MSChart has no results.

What further can I do?
 
Hi,
yes, you have to declare variable as MSChart

Dim fig as MSChart

set it like this in form's load event:

Set fig = myChartControl.Object

then you can pass this variable to your sub:

call Test(fig)

or
Test fig
 
Back
Top