How to get MSChart as parameter?

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
 
A

Alex Dybenko

Hi,
I think you have to add reference to Microsoft chart library, menu
tools-references
 
G

Guest

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

Alex Dybenko

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top