Changing Submodel layout to Horizontal using Macro


I am reading excel sheet and creating entities and attributes. However all entities are created on top of each other.

Once macro is executed, I change the layout to Horizontal manually.

How can I do it in macro itself so that entities are aligned in horizontal fashion before macro is closed?