Well this sounds like it will be dependent on the website itself. If you're able to provide the address for the login page then I can take a closer look tonight. Feel free to PM it if necessary.
Edit:
I happened upon some code for VBA that may work for you. I tried to tailor it to your solution so see if this will work in place of your code block. To find the name, id, etc. of the text box or button you can use the developer tools of Internet Explorer. Activate it with F12, then press Ctrl+b to enable the Selection tool. When you click on your text box or button the window will highlight the line of code pertaining to that particular control. I have a similar C# script that I use but I borrowed this code rather than translate my own to VBA to avoid some headache.
The IE window won't show until after you're logged in. Change the first IE.Visible to True to see it's progress while running.
Bookmarks