Try searching this site (other pages too) for some sort of function that might do what you say. If it says protected, then you will need a memory edit to use it.
Lua functions - WoWWiki - Your guide to the World of Warcraft
World of Warcraft API - WoWWiki - Your guide to the World of Warcraft
If you can't find it, then an (ingame) macro probably cannot be created. BUT, i'm fairly certain bots use a function for this... so there probably is a function you can call. Goodluck!