Hey Paul,
How can we possibly tell, since you didn't post an example macro for us.
We have no idea of what you're doing and can't troubleshoot the problem with a live macro.
If you're trying to use a Select or Show a Menu Item action for this task, then you'll just have to cope with the fact that Apple is incredibly inept in the usability department and changing the sidebar actually changes the menu structure.
To get what you want consistently you'll have to resort to AppleScript.
-Chris