<% %>
is ASP syntax, not HTA syntax. In HTA you could use a nested <script>
tag, though:
<td><script type="text/vbscript">document.write userName</script></td>
BTW, I strongly recommend to use stylesheets for formatting tags (like setting the <td>
background color). It's much cleaner, and also much easier to maintain.