running multiple macros sequentially

The VBA forum deals with IntelliCAD 2000 VBA (Visual Basic for Applications) issues.

Moderator: CMS Inc

Post Reply
MikeC
Newbie
Posts: 6
Joined: Sat Feb 24, 2007 12:01 am
Location: springville,utah,usa
Contact:

running multiple macros sequentially

Post by MikeC » Mon Nov 22, 2010 6:32 pm

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
JCAMPOS

Post by JCAMPOS » Tue Nov 23, 2010 4:28 am

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
Post Reply