In this series I am taking a look at how macros can be used to update data in Microsoft Dynamics GP.
The most common way I update a macro template with the data to be updated, is to use Mail Merge in Microsoft Word.
Make sure you have your data prepared: in the demo system I’m using, I have only four users. I have created some new passwords based on the User Name field and stored them in an Excel spreadsheet:
Make sure the file containing your data is closed or the Mail merge will not be able to read the file.
Take the content of the macro file you recorded and paste it into an open Word document (I replaced the data I’m going to repalce with merge fields with XXXX:
Click the Mailings tab to change the action pane view, and then click Select Recipients and then Use an Existing List…:
In the Select Data Source window, navigate to the location of the source file, select it and click Open:
Confirm the sheet to use by clicking OK (ensure the First row of data contains columns headers is marked before doing so):
Next we want to repalce the XXXX placeholders with the merge fields. Highlight the XXXX next to the User ID, making sure not to select the surrounding apostrophes, and click Insert Merge Field on the action pane; the available fields will be displayed, so select USERID:
Repeat for the Password and Confirm Password fields (use the same merge field twice):
Click Finish & Merge on the action pane and select Edit Individual Documents and click OK on the Merge to New Document ? window:
A new Word document will be produced containing the data merged into the macro template:
This data can be saved as a Text file and then have the extension changed to .mac and is ready to run to update Dynamics GP.