Define the application to send keystrokes to via a variable or per macro

Glad to help. If you haven't seen this already, it may be useful: