Script and Button help

I have made a template spreadsheet for a business. I made it a read only so it doesn’t get erased and each project has its own file. However the person that I am doing this for wants a button in the spreadsheet that will sort the data acending. thats not the problem, the problem is that when the template is opened and saved as the new file name the buttons are still referenced to the template file. I have tried just removing the filename info in the script but I can’t seem to figure it out. please help. andrewsmoore@hotmail.com