Double click your button and you will see similar to below, just choose the VB option. Once saved then go into Mach again then on Operator menu choose Edit Button Script. Your button will be flashing, click it and the editor will open, paste your code in then File and Save and then exit the editor.
Hood