PDA

View Full Version : Need help with defining object methods (my own, not autocads) in autocad vba



Gobc
10-02-2008, 12:22 AM
if i define the following method for a class object Matrix, that I created

Public Sub AddPlane(row As Integer, p As Plane)

I get a syntax error when I try to use the following code:

someMatrix.addPlane(0,somePlane)

If hypothetically i change my method so it only has one argument

Public Sub AddPlane(row As Integer)

then calling it

someMatrix.addPlane(0)

will work.

Can anybody explain why creating a method with 2 arguments isn't callable?

Thanks

Tommy
10-02-2008, 04:24 AM
Hi Gobc :hi:

Welcome to VBAexpress!

To try to answer your question, I would think that a Plane is not defined. I would suggest that you change it to AcadPlaneSurface. I am unsure as to what you are trying to do though.

HTH

Gobc
10-02-2008, 01:30 PM
Hi Tommy,

Thanks for the reply. Plane is an object that I created. Prior to making my post, I did some trial and error to ensure that having a custom object as my function argument wasn't causing the problem.

Gobc

Tommy
10-03-2008, 04:16 AM
I would need to see more of your code to help now. I don't see anything else other than if someplane is not defined as a Plane.

Gobc
10-03-2008, 10:18 AM
thanks for you help Tommy. I got around the problem by defining the sub as a function and returning a dummy value. It just seams VBA won't let me define a sub that accepts two arguments. I have to make it a function and return a value.

Gobc