The closest I came was in the USAF in 1969.
The unit I was assigned to was in the middle of one of those charity drives, where the company commanders were competing with each other to see who got the most signups for donations. A lot of pressure was put on us by the high ranking enlisted people. I said no. The First Sergeant gave me a ration of shit about that and put even more pressure on me. I refused, after explaining that I was already donating to a non-profit and didn't make enough money to add to my donations.
Next thing I knew, I was in the Colonel's office, getting pressured by that officer. He literally ordered me to donate. I knew that there were rules against forcing enlisted personnel to donate to charities. I cited that rule. The Colonel literally threatened to court martial me if I didn't comply with his order. I simply said, "Well, then, I request to be represented by someone from the JAG office." I thought he'd choke on his spittle.
That was the end of it. I never heard another word about it. So, you can stand up to even a Colonel, if you know you're right. I do suggest using great caution before doing that, though.