Without seeing your dog have an episode it is hard to tell what it might be for sure. There are several possibilities as to the cause of this behavior or symptom.
If this only happens once in a blue moon and sounds more like your dog is choking or gasping for air there is a chance your dog is subject to reverse sneezing. (https://www.youtube.com/watch?v=U3L4v0W2_Sw (https://www.youtube.com/watch?v=U3L4v...)). If it happens in the home an Adaptil diffuser may help the dog to be less stressed with strangers and maybe lessen these episodes.
On the other hand, if it sounds more like he is throwing up there is a chance he has ingested something and is trying to throw it up.
If the dog is lethargic, having trouble breathing, etc. it could be a case of heart worms or a heart condition.
If the coughing is accompanied by a runny nose or sneezing it might be a respiratory infection.
My guess is that if it just happens when the dog gets excited it may be pulling on his collar and closing off his trachea so he is having trouble breathing or he is having an episode of reverse sneezing. Let the owner know when this happens, if the dog was pulling on the collar (which is why I don't recommend collars to walk dogs but only to hold their "jewelry"), and what seemed to ease up the coughing.
Remember: A veterinarian is the ONLY person that can diagnose these issues. For the safety of the dog let the owner know when this happens so they can follow up with the symptoms to give their dog relief.
Smaller breeds of dogs have collapsed esophagus that close tight when they become over excited. This also can be attention getting behavior, so don't baby just fine d a distraction and they should come out of coughing
Hello Was all ok? My 9 year old whippet started coughing 2 days ago.....seems to be when she's excited. It's getting less as time goes by. Worth a vet visit still? X