BTW, the GUISwitch command does exactly what it said in the help file, it returns the previously current window handle. Because you created Form2 second, it was the last "current" window, so no matter which window you switch to, Form2 will always be the last window in your script. If you change it to switch to Form1, then switch to Form2, you'll see that the handle returned is from Form1.