Calling a procedure

O

obiwaugh

How do you create a function procedure that calls a sub procedure? I am
trying to execute a Sub procedure by using the RunCode Action in a macro.....
but it tells me: "To run a Sub procedure or event procedure, create a
function procedure that calls a Sub procedure or event procedure."

I've got the Sub procedure working perfectly....just need to know how to call
it from a macro.

Not sure how to do that.

Thanks in advance.
 
M

Marshall Barton

obiwaugh said:
How do you create a function procedure that calls a sub procedure? I am
trying to execute a Sub procedure by using the RunCode Action in a macro.....
but it tells me: "To run a Sub procedure or event procedure, create a
function procedure that calls a Sub procedure or event procedure."

I've got the Sub procedure working perfectly....just need to know how to call
it from a macro.


That's pretty simple:

Public Function CallMySub(arg1, arg2, . . .)
MySub arg1, arg2, . . .
End Function

OTOH, why not just change the Sub procedure to a Function
procedure? There's no particular difference between the two
when you do not use the function's returned value.
 
G

Guest

There is no reason you could not change your procedure type from a Sub to a
Function. There is no requirement you pass a function an argument or that
the function return a value.

If you don't want to make the change, then all you need to do is create a
function that calls the sub. This is a waste of time (see the first
paragraph), but doable:

Public Function DumbWayToDoIt()
Call TheRealThing
End Function
 

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