If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Code for Printer Setup
I know that this has been asked a million times before. And the title is
always different, so the posibilty of finding the correct answer is probably very low. But has there been any updates in the way that a printer setup can be controlled with VBA or Macro coding? The reports in my databases switch from portrait to landscape, plus my databases are networked, with different printers. And with the myraid of printers out there, I do not want to have code for every single different printer type out there. I have just upgraded to Office2007 and am in the process of converting over the databases. Before, I would get calls about why the reports were coming out different (portrait/landscape) and I could not give a good enough answer nor could I find a resolution to the problem other than coding for each individual printer in the company. Any answers would be helpful since I am about to purchase new printers. |
#2
|
|||
|
|||
Code for Printer Setup
Okay, you are asking how you can programmatically assign a printer to a
report at runtime, and set its orientation. Since Access 2002, Access has a Printer object. Before you OpenReport, you can assign it to one of the Printers available on the user's machine, and the report will go to that printer. Then you need to set the Printer to Nothing again; otherwise all their reports go to that printer (rather than their default.) If you want that to persist, you can store the info in a table, or create a custom property for the report so it emembers to send that report to that printer. There's a downloadable example of how to do that he Printer Selection Utility - Users assign printers to reports at: http://allenbrowne.com/AppPrintMgt.html You can also set the orientation and margins programmatically once the report is open in preview. See the SetMarginsAndOrientation() function at the end of this page: http://allenbrowne.com/AppRelReportCode.html -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Joseph" wrote in message ... I know that this has been asked a million times before. And the title is always different, so the posibilty of finding the correct answer is probably very low. But has there been any updates in the way that a printer setup can be controlled with VBA or Macro coding? The reports in my databases switch from portrait to landscape, plus my databases are networked, with different printers. And with the myraid of printers out there, I do not want to have code for every single different printer type out there. I have just upgraded to Office2007 and am in the process of converting over the databases. Before, I would get calls about why the reports were coming out different (portrait/landscape) and I could not give a good enough answer nor could I find a resolution to the problem other than coding for each individual printer in the company. Any answers would be helpful since I am about to purchase new printers. |
Thread Tools | |
Display Modes | |
|
|