Which version of my suggestions in post #12 are you trying? If the first suggestion and the error line is still the one containing .GetElementsByTagName() then there is still an issue with .GetElementsByTagName().

If you are using the second suggestion, then try using the first and see if the error moves to the if statement.