How is the port order in a macro determined?
The ports in a macro will always be in the order of instantiation of the objects connected to those ports. For example, if you have a macro and instantiate objects a, b, and c, in that order and export the output port of object c, then a, then b, the output ports will get added such that the first output port is object a’s, the second is object b’s and the third for object c’s. There is no way to change this, except by deleting the objects and reinstantiating them in a different order.