PrintForm -- center on page?

Posted on 2004-04-08
Last Modified: 2012-05-04
I'm using the PrintForm command... however, I'd like to center the image on page... how is this possible?

I tried experimenting with this code over here, but haven't came up with much...;en-us;q148392

Any assistance is appreciated...

Question by:NO_CARRIER
  • 3
LVL 28

Expert Comment

ID: 10784469
Will this work?

'apply same scale mode to printer
Printer.ScaleMode = Form.ScaleMode

'position current printing coordinates
Printer.CurrentX = (Printer.ScaleWidth - Form.ScaleWidth) / 2
Printer.CurrentY = (Printer.ScaleHeight - Form.ScaleHeight) / 2

'print form

Accepted Solution

Burbble earned 100 total points
ID: 10797686
Unfortunately, the .PrintForm method simply sends the image to the printer directly so you cannot alter it.

What you would have to do is save an image file (bitmap) of the form, and then set the Printer's CurrentX and CurrentY and finally .PaintPicture the saved image.

Here's some good example code that will help you with this:


Expert Comment

ID: 10797692
The example prints the image fit to page (scales it as big as possible), but you can easily remove that portion of the code to circumvent that from happening.


Expert Comment

ID: 10894482
Glad to be of assistance ;-)


Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excel VBA, find a string in a column, update a cell 7 86
MS SQL store procedure to calculate and return result 6 63
VB 6 error 5 in windows 10 but not in XP 7 64
vbModal 12 57
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question