"When ours won't behave I spray them with water. Works on dogs and cats alike. After a few spritzers, now I only need to pick up the spray bottle and they stop."
This didn't work with my cat. He didn't like it at first,but after a few times getting sprayed he changed his mind. He would literally close his eyes and open his mouth!! He loved to be around when I was sewing. Too many things moving around to interest him.
I never found any way to keep him out short of shutting the door and listening to him cry.......