running multiple macros sequentially

#1
Hi,

I'm building an app to create an Epanet Inp file from the drawing objects.
I've divided the variuos into several functions each handling a discrete task. inow have several function that need to be run in a specific order to build the epanet file this works fine. I'm trying to put all the sub routine calls into function called Oneshot this works from a form button, when i call on Oneshot from the toolbar using ("-vbarun" & vbcr & "c:/mike C/Intellicad vba/epanet 1.dvb!module1.oneshot" & vbcr). can't find macro is returned. Is if ok to have a function with only functions or sub call in it?
Like this:
Public Function OneShot()
call sub or function name
call sub or function name
call sub or function name

form.show
end function

If not a push in right direction would be great

Thanks MikeC

#2
Hi MikeC,

There is no problem to put your calls in a function, however, unless you need to return a value from that function, I would put them in a sub.

Code: Select all

Public Sub OneShot()
call sub or function name
call sub or function name
call sub or function name

form.show
end Sub
I suggest you to separate the call that loads the vbi file and runs the macro. Load first the vbi file with the VBILOAD command (this should be done at program's initialization and only once - if you try to load the vbi file twice or more you will get a message saying that the vbi file is already loaded) and then run the macro with the -VBARUN command anytime you need.

Thanks,
JCAMPOS
cron