To understand what is going wrong we need to see more of your code,preferably the whole sub.What line of code gives the error? What is the error message?