Skip to main content

Notifications

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

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,036 Most Valuable Professional on at
    RE: Update today's Date in Macro

    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

  • Community Member Profile Picture
    on at
    RE: Update today's Date in Macro

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

  • David Musgrave MVP GPUG All Star Legend Moderator Profile Picture
    14,036 Most Valuable Professional on at
    RE: Update today's Date in Macro

    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

  • Suggested answer
    L Vail Profile Picture
    65,271 on at
    RE: Update today's Date in Macro

    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

     

     

  • Syrus Profile Picture
    4,156 on at
    RE: Update today's Date in Macro

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

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

Jainam Kothari – Community Spotlight

We are honored to recognize Jainam Kothari as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
Almas Mahfooz Profile Picture

Almas Mahfooz 3 User Group Leader

Featured topics

Product updates

Dynamics 365 release plans