Candy didn't sabotage my efforts to lose weight. I recognized very early that I was susceptible to sugar. Eating any kind of sugary food just made me want more sugary food. A cookie turned into 10 cookies, a pack of M&Ms turned into another trip to the vending machine.
I found out that it was much easier to say "no" to the first cookie than the second cookie. So, I put a bunch of food on a "no" list when I started - fast food, soda, candy, most fried foods, most sugary foods.
If there was candy at work, it didn't bother me since I wasn't eating candy
It was a radical approach, but it really worked for me and helped me to kick the sugar addiction that was making me crazy.
Now, at maintenance, candy out of a bowl at work is still on my "no" list - because there isn't a limit how much I could take and I know that I would have troubles eating one piece of candy and then stopping. If I'm going to eat a treat, I stick to something in a single portion, like a fudgy dessert at a restaurant or a scoop of ice cream.