I believe this function is the best way. Looks like it is broken though. You could convert the four letter code to a number (for instance footman 'hfoo' is 1751543663), but I cannot get the WE prompt to put in more than 1000000000 for a number.
It will work if you use customscript: BlzSetUnitSkin(<unit>, < new unitcode>)