Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

Update today's Date in Macro

Posted on by Microsoft Employee

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
    David Musgrave MVP ... 13,928 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
    Community Member Microsoft Employee 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
    David Musgrave MVP ... 13,928 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
    L Vail 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
    Syrus 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans