I have a button that i would like to setup to run what i think is a simple function.  First off, this is on a router that we run a common sheet size on, but change tools often. 
I have setup home switches for x,y,and z.  Z homes to the table top. 
I would like a Auto tool zero button that does these functions. 
z+3
home x
home y
home z
z + 3
The VB code i have for the button is 
Code "G00 Z3"
DoOEMButton (1022)
DoOEMButton (1023)
DoOEMButton (1024)
Code "G00 Z3"
What is happening is as follows:
Z lifts to +3
Z lowers to +2
Home X
Home Y
Home Z
How do i make this Code run in the order i put it in?