VBA – Running VBA scripts after Login or before Logout Example

This is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.
Sometimes you need to run VBA (Visual Basic for Applications) scripts after a successful login attempt. Using the OK Button on the Company Selection window does not always work as the login could still fail. For example, the user is already logged into the selected company. Also this does not help capture the logging out.
