After you have reprogrammed it by turning on ignition and pushing button on remote until doors lock and unlock, what happens if you immediately get out of the car and push the button? If it works when you are in, or standing next to, the car but fails as you move away that would suggest a weak battery.
If changing the battery, while you have the fob open check the battery connections, they sometimes come loose at the circuit board causing an intermittent loss of power, which puts it out of sync.
BE CAREFUL when opening the key fob, there may be a small immobiliser chip inside, dont lose it!
denny, January 2010