What Witto is saying is that you have posted the UDF and we all know the UDF is fine, the problem must be in your code or a related problem. Please post your entire code so that we can better help you.
_________________________
Wait don't order yet,... get KiXforms Designer .NET 2.0 (Beta)
KiXforms Designer .NET 2.0 (Beta)