we used to live next door to a "god fearing" lady who had a King Charles Spaniel who loved humping cushions. I was only young at the time but I got told that he had 'ruptured his willy' and that there was blood everywhere -> that's what my mum told me, and mothers never lie - YEAH!!
He is excited because of the company. He gets excited that theres company and then he has all this built up energy from becomming excited, so he has to get rid of that excess energy. He has found his outlet of this energy by humping. Maybe try to take him for a long walk befor company comes over (if you know ahead of time). This way he should be tired and wouldnt have so much excess energy to use up when he gets excited from the company.