Hybrid – Running a macro to automatically close GP Example

David Meego - Click for blog homepageThis is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.

The following VBA example shows how a macro file can be started from VBA. This particular example will close Microsoft Dynamics GP when the Check Links window closes. As macros wait for background processes to complete, the macro will not start until the Check Links process and report have completed.

The code will create a text file with a .mac extension with the appropriate macro language command to exit Microsoft Dynamics GP as though the user selected File >> Exit.  It then runs the macro file. To make this possible we are executing pass through Dexterity sanScript using the Continuum Integration Library.

NOTE: This customisation uses a method of executing Dexterity sanScript code from VBA which is unsupported by Microsoft.

Example code for v8.0, v9.0 & v10.0 is attached at the bottom of the article.

Please see the “Installation Instructions.txt” file in each version’s archive for more information.

Automatic Exit after Check Links closes.zip

This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on http://www.winthropdc.com/blog.

7 thoughts on “Hybrid – Running a macro to automatically close GP Example

  1. Phillip Goza's avatar

    Hi David,
    If I wanted to use this technique to populate serial and lot line items on the sales transaction screen, would I still write a macro and then call the macro from the script?  Or could you jwrite Dexterity code instead and execute the code using the ExecuteSanScript command?  I guess I’m confused as to the difference between the code in the macro and actual Dexterity code.
    Thanks,
    Phil

  2. Hussain Al-Yousef's avatar

    Hello David,
    This is a good code. I wish you make more examples on this and expand the subject.
    Hussain Al-Yousef

  3. news@bbc.ca.tc's avatar

    Hi David,
    Nice code… Do you think it could be use also as a timed / scheduled task to log off automatically a user past a certain time ? We do use the OminTools / GP Toolbox to log off users after a predefined inactivity timeout, but in certain cases where users are on the exception list, those user tend to forget to close their GP session at the end of the day..
    Thanks for your tips
    Beat

Leave a Reply to David MusgraveCancel reply