|
-
Nov 8th, 2000, 10:16 AM
#1
Thread Starter
Lively Member
How would I reference a module as an object. I have a line of code that uses the CallbyName function. I want to say CallbyName(myModule, myProc, vbmethod, (myarguments)) Any ideas on declaring this module as an object and setting it so that I can use it?
-
Nov 8th, 2000, 10:26 AM
#2
Fanatic Member
Create a Class Module (MyClass) with a method (function) "myproc", and then instance it thus:
Dim oClass As myClass
Set oClass = New myClass
returnvalue = CallByName(oClass, "myproc", vbMethod, args...)
The arguments must obviously be in line with the function declaration.
Cheers,
Paul.
P.S. CallByName uses Late Binding and is pretty slow, you could just use
returnvalue = oClass.myproc(args)
P.
Not nearly so tired now...
Haven't been around much so be gentle...
-
Nov 8th, 2000, 10:54 AM
#3
Fanatic Member
Having just seen your previous thread, the reason CallByName works in a form is that a form IS an object. CallByName only works with objects which is why you need to use a class module to create an object whose methods you reference.
Hope that is clear,
Paul.
Not nearly so tired now...
Haven't been around much so be gentle...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|