Unfortunately macros cannot decide on actions based on current buff/debuffs.
I suspect the reason the macro 'fails' and doesn't use Soul Swap is that you currently have a GCD triggered when you press it. As Soulburn is off the GCD it will always fire, but Soul Swap will fail as it still has the GCD applied.
Your options are:
1. Paying attention to when you use the macro so as to not use it when the GCD will stop Soul Swap
2. Spamming the button a little when you use it, Soulburn has a short cooldown of 1 second - which should be enough to get a Soul Swap off when the GCD ends (may still cause Soulburn to use another shard though, depends on the GCD length).
3. Change the macro to a castsequence and spam it without worry:
Code:
#showtooltip
/castsequence reset=1 Soulburn,Soul Swap
Only problem is, if you don't have a shard for Soulburn you can't use Soul Swap on it's own this way.
A solution to that is to add a conditional to cast it on it's on via modifier.