How does it get into that sub? Are you referring to it as a global, or do you pass it in as a parameter?
I guess what I'm really getting at is that your example code might be a bit too stripped-down for us to accurately diagnose your issue. There appear to be quite a few significant gaps. Can you flesh out your example code a little more, or is that really your actual code?