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)

Update today's Date in Macro

(0) ShareShare
ReportReport
Posted on by

I have been putting together a macro in GP and ran into a problem getting the macro to update with today's date.  I would just leave it blank, but the report won't run without a date in there.  Does anyone have a suggesting how to get this to update with today's date?

ActivateWindow dictionary 'Cinch Ag'  form IRASXMLExportEntry window IRASXMLExportEntry
  TypeTo field 'Start Date' , '06012017'
  MoveTo field 'End Date'
  CommandExec form BuiLtin command cmdEditPaste
  TypeTo field 'End Date' , '07262017' (This needs to be the current date)

*This post is locked for comments

I have the same question (0)
  • Syrus Profile Picture
    4,156 on at

    I wonder if you can use Date function such @now VBA vs. Dexterity

  • Suggested answer
    L Vail Profile Picture
    65,271 on at

    Hi,

    Typically, the user date is today's date. With a macro, you can copy the user date and then paste it wherever you want. To get this to work correctly you need to use Edit | Select All | Copy and then at your destination use Edit | Select All | Paste. After that, edit your macro to remove the 'TypeTo' line that will always record after a paste. The copy and paste part would look something like this in your macro:

    NewActiveWin dictionary 'default'  form sheLL window sheLL
      CommandExec dictionary 'default'  form 'Command_System' command UserDate
    NewActiveWin dictionary 'default'  form 'Switch Date' window 'SY_Set_User_Date'
      CommandExec form BuiLtin command cmdEditSelectAll
      CommandExec form BuiLtin command cmdEditCopy
    CloseWindow dictionary 'default'  form 'Switch Date' window 'SY_Set_User_Date'

    (Your macro code to navigate to wherever you want to paste the date)

      CommandExec form BuiLtin command cmdEditSelectAll
      CommandExec form BuiLtin command cmdEditPaste
    #  TypeTo field '(L) Starting Date' , '04132017' DELETE OR REM OUT THIS LINE

    Kind regards,

    Leslie

     

     

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,095 Most Valuable Professional on at

    If you want to fully automate this so you don't need to manually run a macro, you should look at Visual Basic for Applications (VBA) or GP Power Tools' Developer Tools module.

    David

  • Community Member Profile Picture
    on at

    I am not familiar with Power Tool's.  How could it help?

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,095 Most Valuable Professional on at

    GP Power Tools has many features in it's three modules. I know that you will want the tool once you see what it can do.

    The functionality I am talking about here is the ability to create custom trigger scripts on against any Product Dictionary in your system. So when you open the window you can just set the dates to whatever values you desire.

    The other advantages is this works with the web client (unlike VBA) and once created is immediately available on all workstations.

    David

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
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans