Macro to change the orientation of a model

At present I manually change the orientation of my assemblies/parts to a saved view and then run a macro to do some specific tasks.

I was thinking it's much easier to add some codes to the macro and change the orientation first and then run the rest. But I couldn't find anything in this forum or other sites.

Now my question: Is there any way to change the orientation of a part or an assembly in a macro?

thanks for any kind of help.

SolidworksApi macros