Link to home
Start Free TrialLog in
Avatar of alevin16
alevin16Flag for United States of America

asked on

Screenprint a form in Access using VBA

Hey Everyone,

This does not seem like a big deal but for some reason I cannot figure it out.  I have a very busy screen (lots of fields and data) and I want to have a button that will do a printscreen.  Right now I have the user do an ALt+PrintScreen, paste the result into Paint, and then print from there.  

Is there an easier way to do it via VBA?  I have tried this code:

DoCmd.SelectObject acForm, Screen.ActiveForm.Name, False

and it crashes Access.  I have attached a jpg of the screen
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of alevin16


I tried the ctrl+p but it did what happened before, crashed access.  I completely agree with you that printing the form is a waste of toner but they are very set in their ways and they want to print the entire form.  Believe me I tried selling them on creating a report but they did not want to hear it.
The whole idea is to give them a report that looks like the form but without the background color and the buttons cluttering up their report.  Why would they be opposed to this if you give them a button on the form that prints exactly what they see without the clutter?
You can use LSM's code to copy the screen to the clipboard...
But if your ultimate goal is to also paste the image into paint, ...then print it out (meaning all three of these steps to be done via VBA automation), ...then this is another story.

You can also do as IrogSinta suggests...
(Print the Form, or create a Report for printing)

So it seems that your ultimate goal here is unclear.
Do you actually want just a screenshot of the form (perhaps as a training tool?)
...Or do you just need a printout of the form to see the data?

I wish I knew.  Maybe they cannot picture it.  I may have to go forward and create it and show it to them, but I don't feel like wasting all that time just to have them say no.
Hello JeffCoachman,

WHen they explain it to me it sounds like they just need the data (I have no clue why anyone would need to see a button etc) but when I said I would create a report that looked like the screen they freaked out and said that they cannot have it that way for their files.  They need to have a printout of the screen EXACTLY as it shows on the screen with the buttons, data and everything.  I am thinking I might have to use a macro recorder and record the steps for a screen print and just do that (not incorporate it into the access program)
Show them this and see what they say about a report looking like it.
The code at the sample I linked does just that - it prints the screen. What would be the point of a macro recorder?

Ok, thanks for the clarification...
I'll let you continue on with the other two experts to avoid confusion...

Hello LSMConsulting - I tried the code but the printing part of the code did not work.  It claimed it did not understand this line:

 Printer.PaintPicture Picture1.Picture, 0, 0

I think I am going to have to just force them to accept a report that looks like the screen without the buttons.