web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

How to "wait" for 45 seconds between running 2 Macros from VBA.

(0) ShareShare
ReportReport
Posted on by

One of my clients is still on GP 8.0 and uses Project Accounting with over 100 companies. They spend Saturday and Sunday every week to run PA reconcile process on about 50+ companies each day. The list of companies is dynamic so I use an SQL Table and have them mark Saturday and Sunday columns as “true” so the routine would know which companies to reconcile.

 

1.       We use login macro automation to log into the first company.

2.       We use your Toolbar package and in VBA pull the first company selected for this day and create Change Company Macro

3.       From VBA using your code we execute the newly created Change Company Macro.

4.       Per client we need to wait 45 seconds before calling a “PA Reconcile” Macro.

a.       Some companies are done in seconds, some takes almost one hour.

5.       We would like after the PA Reconcile Process is finished (I assume that we can use a code on a window close event ) to take the next Company from the list and keep repeating steps 3 -5 until all of the selected for the day companies are done.

 

I started testing and noticed when I start a wait (using kernel32 Sleep function) everything freezes.

 

Is there a way to put a pause/wait period after running Change Company Macro and before running PA Reconcile Macro.

 

Also, they are not able to disable a screen saver – will the screen saver interfere with the VBA and Macro process.

They would like to start this process as a scheduled task – so the workstation/server could be logged off, or a remote session disconnected.

 

Could we accomplish our goals by using GP Macros and VBA?

 

Thanks,

 

*This post is locked for comments

I have the same question (0)
  • winthropdc Profile Picture
    on at

    Hi Ary

    Macros normally wait for foreground and background processes to complete before they continue.

    You could try starting a second macro using VBA after a specific event.. see the blog post below:

    Hybrid - Running a macro to automatically close GP Example

    http://blogs.msdn.com/developingfordynamicsgp/archive/2008/09/10/running-a-macro-to-automatically-close-gp-example.aspx

    NOTE: You will need the workstation logged in for the Dynamics GP client to run. 

    David Musgrave [MSFT]
    Escalation Engineer - Microsoft Dynamics GP
    Microsoft Dynamics Support - Asia Pacific

    Microsoft Dynamics (formerly Microsoft Business Solutions)
    http://www.microsoft.com/Dynamics

    mailto:David.Musgrave@online.microsoft.com
    http://blogs.msdn.com/DevelopingForDynamicsGP

    Any views contained within are my personal views and not necessarily Microsoft policy.
    This posting is provided "AS IS" with no warranties, and confers no rights.  
     

  • Community Member Profile Picture
    on at

    Thank you David,

    Ok, I will log into GP Client using login macro from Scheduled Tasks and using your Toolbar will be able to respond to the window open event. When I tyr to run a macro using the technique in your post bellow, for example just open a Project Accounting Reconcile window, the window opens before the the login processes are complete. http://blogs.msdn.com/developingfordynamicsgp/archive/2008/09/10/running-a-macro-to-automatically-close-gp-example.aspx

    The user id, company name and the date are still greyed out.

     If I place a wait command before opening a PA window, the window attempts to open any way. Basically it seems to read all of the events commands and execute them in an order that I do not understand. If I execute a Change Company macro on GP login and after that attempt to open a PA reconcile window, window opens first. If I place a wait command in the PA reconcile window open event, everything stops until the wait is over.

     Thanks,

     Ary

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Community Member Profile Picture

Community Member 2

#2
mtabor Profile Picture

mtabor 1

#2
Victoria Yudin Profile Picture

Victoria Yudin 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans