Hi all,

I've been working on a user-written ado file that with its current name works perfectly fine. But wanted to change the name of the ado file -and the main program accordingly- and when I do that (without closing stata) and run the do file that calls the ado it has problems loading the ado. It tells me that a program that is also created in the ado file -but which is not the main program- has already been defined and I get the following error message in brackets "error occurred while loading xx.ado". This surprises me since before creating the program appears the following line:

cap program drop programname

This line should force stata to drop the program with that name before creating it again but for some reason, it doesn't.

So, I tried closing stata, opening it again and running the do-file that calls the ado with its new name and works perfectly fine. I guess this means the problem occured when changing the name of the ado and loading it again. But is there a way of keeping this from happening, that I don't need to restart stata to load the ado-file properly?

Thanks for your help!!