Quote Originally Posted by RoYeti
Compile errors:

Only comments may appear after End Sub, End function, or End proprerty
This tells me that you have pasted the code in the wrong place on the form.

The API declare should be in the Form's declaration section along with the constants declarations.

The calls should be placed in an event, such as a Form_Load event or a button's click event.