Reputation: 757
I am having a problem when my program is installed to another computer, where its printer preference is different, where my data report accepts Letter size 8.2 * 11 in, because when the printer preference is different the data report well not show and gives an error saying the page width is larger than paper width, does anyone know how to fix this problem.
i tried this code but it didn't work
Printer.PaperSize = vbPRPSLetter
Upvotes: 1
Views: 8508
Reputation: 1
To change Printer orientation at runtime, we need to install VB6 Service pack 6
Use this code
DataReport1.Orientation = rptOrientLandscape
DataReport1.Show
This will work fine
Upvotes: 0
Reputation: 30398
Check out the Microsoft KnowledgeBase article FIX: Error Message "Report Width Is Larger Than the Paper Width" When Showing Data Report in Landscape
When using the Show method of Data Report to preview the report, the page orientation defaults to the default printer settings on the local computer. Therefore, if the orientation of the default printer settings is set to Portrait of standard Letter paper and your report width is more than 8.5 inches wide, the following error occurs: Report Width is Larger than the Paper Width.
The solution appears to be setting Orientation
before using the Data Report. Change DataReport1
to the name of your data report.
DataReport1.Orientation = rptOrientLandscape
DataReport1.Show
EDIT Another suggestion: Microsoft offer a free DLL that allows you to change the default settings for the printer. You could try using that free DLL in your project, then do something like this code below before using the data report. Microsoft say "this DLL is particularly useful when dealing with the Data Report, which reads the default printer orientation prior to displaying or printing a report."
Set obj = New PrinterControl
obj.ChngOrientationLandscape
Upvotes: 1
Reputation: 1570
-Can you just switch to a custom paper size?
Printer.PaperSize = 256
Printer.Width = 11808 '(8.2 * 1440)
Printer.Height = 15840 '(11 * 1440)
-Are you sure the error isn't related to the maximum print width of the report itself? Many printers have a max print width that forces 1/4" margins on either side of a paper. Which in your case forces your printable area to be 7.7" max. Quickest way to check would be to temporarily set the print wide to a lower value and see if it works.
-Another possibility could be permissions to the printer. If it's a shared network resource it may be locked down and be rejecting the changes to the paper settings and throwing an inaccurate error msg.
Upvotes: 1