If they are your close friends and co workers, you gotta tell them you're vegan if they keep giving you foods that aren't. If you accept them and throw them away, eventually the friend will find out you're vegan and say, "Hey, but what did you do with the fudge I gave you?" If you tell them you threw it out that's even worse than a polite thank you with an explanation.
I just say, "Oh those cookies look great, but I can't eat them since I'm vegan. Would you mind if I passed them along to someone else?" or ask if they would like to give them to someone else.
If people feel rejected and you did not intend to reject them, that's their issue to work out.
On the other hand, you want to be careful not to offend people outright by saying something like, "God, I can't believe you would disrespect my lifestyle choice by offering me fudge. Are you trying to say you don't respect me?"