I've done a custom Hex spell before.
How Hex works is that it chooses from a pre-determined set of units that the target is randomly transformed into. These are critters, so by default the hero cannot attack.
However, what you could try doing is create custom critters which do have an attack. This might enable the hero to still attack while hexed. No promises.
Otherwise, Hex might be hardcoded to disable a hero's attack regardless. In that case you'll need to do some fancy metamorphosis / unit changing to get the effect you want.