Hey,
The problem with your weapon swap isn't that fact that the macro isn't working its that it doesn't do anything
...you see you can equip both melee and ranged weapons at the same time so effectivly your macro just re-equips the items...to pull out your gun while your knives are already out simply click on autofire and to pull out your knives just right click on the enemy once your cursor changes to the dagger icon...i hope this helps
-DRock
P.S. you can also press the 'z' key to pull out your weapons when you arn't in combat