I keep getting a rule compile error "all other subs and functions must appear after sub main" (see attached) for one of the rules in an assembly file. The thing is, Sub Main is the only sub or function in the rule and the only thing outside of it is my option explicit line. I checked, double checked, and then triple checked that I didn't have some stray sub statement somewhere and that Sub Main didn't have a typo. I even tried deleting the option explicit line and making Sub Main the very first line in the rule. I would just blow away the sub / end sub since it's the only one in the rule but I need to pass variables to it and I'm using the Sub Main(ByVal variable As Single) statement.
The wierd part is that it worked just fine yesterday, and I can't think of anything I've changed since then.
Any thoughts?
Solved! Go to Solution.
Solved by MjDeck. Go to Solution.
I managed to get a work around by commenting out the sub/end sub lines and passing the variables using an argument map and accessing the variables directly using the rulearguments function. I'm still curious why Inventor doesn't like me using the ByVal argument, though.
As you found, you have to use the RuleArguments function. There's no way to pass arguments directly to Sub Main(). We could improve the error message.