I also had a problem with eating snacks at work. Then I understood that I started put on extra weight. Then I had to change some of my eating habits. I started eating healthy snacks like fruits, nuts, yougurt (you can fins some ideas here
https://www.tipweightlossdiet.com/best-healthy-weight-loss-snacks-in-the-morning-afternoon-or-late-night/) instead of sweet and high-calorie snacks we were provided at work. I was enough to normalize my weight.