Don't use Activate for stuff like that.
You have that Code in Activate, you run your program, it works, on the side you open a WebBrowser, you surf to a site to check something (Browser having Focus!), you go back to your program, your code executes again!
Basically, what Josh said: Use a status-Variable