Repost: Paper Size VBA Code

A

Andy

Allen;

Thank You for Your reply.

The database is distributed as an MDE. Save isn't an option.

I caught a glimpse of the VBA code "papersize = 5". Which would "Force" the
report page to print on legal size regardless of the application or OS
version..
302416 ACC2000: How to Build a Visual Basic Module to Print a Report in
Landscape Mode on Legal-Size Paper.

It is so long and complicated. There must be a pared down version
somewhere.

Allen; again Thank You.

Andy

The printer drivers for Windows XP are different than Win98, so if you saved
them for a particluar printer in Win98, it won't look the same to Access
under WinXP.

Open the report in design view in WinXP. Choose Page Setup from the File
menu. Specify the page size, and save.

There is a bug in Access where the printer settings are lost if Name
AutoCorrect is enabled. You need to turn that off. Details:
<http://members.iinet.net.au/~allenbrowne/bug-03.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.

Hi;
Used A2K in Windows 98SE to create an MDB database.
2 of the reports print on legal size paper all other reports print on letter
size.

When the database is opened on a computer running Windows XP the reports
that should print on Legal Size paper print on letter size.

Believe that the code for Legal Size paper is: papersize = 5

Don't know in which event to place this code or if this is the entire >
code.

Have searched Microsoft, either I'm not finding the answer, don't >
understand > the answer or the answer isn't there.

Can someone point me in the right direction?
 
A

Allen Browne

Hi Andy.

Best to post these as a followup, if you can find the original thread. Not
sure I have an answer: perhaps someone else will.

If you save the report for the default printer before creating the MDE, it
should work on whatever the user has as their default printer, with whatever
paper their printer has as default, and whatever margins you set it to
before you saved (assuming that is not outside the printable area of the
printer). The user can adjust with File | PageSetup, or by adjusting the
defaults for their printer.

In Access 2002 and 2003, you can dynamically set the Printer object at
runtime. This does not adjust the page size, but the user might be able to
create an "alternate" printer, set it up with the paper as they wish, and
then print to that. There is an example utility that shows how to work
through the issues of associating one of the user's printers with each of
their reports in this link:
http://members.iinet.net.au/~allenbrowne/AppPrintMgt.html
Note that that technique is not suitable for A2000 and earlier, but there is
a link for A97 and A2000 users to another approach.

I fear that has not not answered your question though.
 
A

Andy

Allen;

Thank You for Your reply.

You certainly earned the title of "MVP"

Setting the Printer Object is not a viable solution. Too many systems and
enentually the current printer will be replaced.

Except for the Legal Size paper setting reverting to Letter size, everything
prints and displays correctly on every system as is. The irratant is that
the user has to open Page Setup and select Legal each time the report is
printed, (which is quite often).

Allen; I know that the "Auto-Correct" is off and that SR-1 or higher is
installed on the machines.

Don't know if You had a moment to read through:
302416 ACC2000: How to Build a Visual Basic Module to Print a Report in
Landscape Mode on Legal-Size Paper.

The PaperSize=5 example is included in perhaps 50 lines of code.

Will pare out what is needed and post the answer here.
(May take awhile)

How do you post as a followup? You mentioned: "find the original thread".

Thank You.

Andy
 
A

Allen Browne

Okay: just checked the article. That approach works, but it requires you to
open the report in design view. It is therefore unsuitable if you plan to
release an MDE.

Regarding the value 5 for legal size, these are part of the acPrintPaperSize
type. You can find that and enumerate the values if you
open the Object browser (F2 in the code window), e.g. acPRPSLegal = 5.

Posting a follow-up will depend on the interface you use to post from. If
you are using Outook Express 6 as your newsreader, you should be able to:
View | Current View | Group messages by conversation
You can also filter your own threads with Ctrl+H.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top