Save the code under system macros.
1. In the Project Explorer window, double click System Macros
2. Cut and paste the code
It will now be available under Query Options, Record Processing, VBA Macro