I have a MacBook (2008) that sleeps as soon as you put in a battery
Had similar problem, so took it to Genius Bar for investigation. Turned out to be the battery charger sensor module, which is built into the battery level indicator on the side of the Macbook (the 5 green light thing). It was malfunctioning, basically telling the Macbook that any battery was dead, even if the battery was good. YMMV.