Just a thought but I seem to remember that you can't declare variable types in vbscript.
How about sticking a test msgbox in the middle of the code to see if the variables are being recognised and accepting the values you're allocating to them?
If they're not, then try removing the "as string" bit from your declaraton and see if that helps.
Other than that your code looks as though it should work. One other thought is if it's in the right event. Perhaps you could insert a test command button and put the code behind the Click event and see if it woks then.