This is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.
Named Printers is a module to allow controlling of the printer and settings used when printing reports. It was originally developed for v3.00 by me while I was working for Sequel Technology (that’s why the tables and calls are prefixed with ST). Later it was purchased by Great Plains for v5.50 and included in core code (Dynamics.dic) for v6.00 onwards.
Named Printers works for any report that is set up to call Named Printers, but what happens when you want Named Printers control for a report that is currently not supported… Well, you can use VBA to call the appropriate Dexterity sanScript functions via the Continuum Integration Library to add a new Named Printers Task to the Assign Named Printers window. Then the code can read the setting for that Task and change the application default printer just before the report is printed. After the report is printed, the correct default printer is restored using the System Default and Company Default printers. The Company Default printer takes precedence if one is set up.
This example adds Named Printer control when printing from the Inventory Transaction Inquiry window when using the window print button. The code is configured so that the Printer Task is only available from the Assign Named Printers window while the Inquiry window is open. When the window is closed the Printer Task is removed and the settings selected are removed. To make the settings permanent, you will need to comment out the “clean up” script when the window is closed.
NOTE: This customisation uses a method of executing Dexterity sanScript code from VBA which is unsupported by Microsoft.
Example code for v8.0, v9.0 & v10.0 is attached at the bottom of the article.
Please see the “Installation Instructions.txt” file in each version’s archive for more information.
This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on http://www.winthropdc.com/blog.