Copy Access Report to Clipboard using VBA

Hello,

I want to send a report to the clipboard automatically using VBA.  I have seen how to do one field but I want the entire report as it looks in Print Preview.

Thanks
vmccuneAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
I do not believe that to be possible. What you can do, is automate the creation of PDF, and then place that PDF in the clipboard.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vmccuneAuthor Commented:
How would I add the PDF I created to the clipboard?
0
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
I haven't tried it myself, but you could look into the link here:
Copy file to clipboard
0
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

vmccuneAuthor Commented:
Yes I have seen that but there MUST be a more simple approach to this.
0
Gustav BrockCIOCommented:
A clip must have some kind of format or type or be a file. I'm not sure which of these you would expect to copy from a report, not to say where to paste it.
Pages are displayed one or two at a time, so not even a screenshot will do. Thus, your options are to either export or print the report to Word or PDF.
0
Richard DanekeTrainerCommented:
Once in the clipboard, where will you put it next?  If we were aware of that, maybe we could offer a simpler solution.
0
vmccuneAuthor Commented:
The file is a PRF.  Once in the clipboard I want to past to an outlook email or maybe a word document.  My goal is to take a closed pdf and paste it as the open image in the clipboard.  If there would be a better way to do this with just an Access report I can go that way as well.
0
Gustav BrockCIOCommented:
Then you can use this command:

DoCmd.SendObject acSendReport, "YourReportName", acFormatPDF, "receiver@example.com", , , "Test Print", "Body ...", False

Open in new window

0
vmccuneAuthor Commented:
Yes, that would be fine if I was going to email for sure but it may or may not require that.  I really just need to get it to the clipboard so I can paste it wherever I want from that point.
0
Gustav BrockCIOCommented:
You could set the last parameter to True. Then the mail will not be send automatically, just opened, and you could save the attachment wherever you want.
Not fancy but extremely simple ...
0
vmccuneAuthor Commented:
Yes. You are right.  sadly the goal of this effort for the user is not to have to select or hit "Copy" and then "Paste" if it is not an email.  Also many times it will be to respond to an email they have received.   Simply put, I need a command button on a form that will send the Access Report to the clipboard as an image with no additional steps.

Thanks again!
0
Gustav BrockCIOCommented:
Then we are back at Ander's very first comment ...
0
Richard DanekeTrainerCommented:
Version information would be helpful as well.
For example, if you use the suggestion and create and save the .pdf file to the computer, on 2016 Office apps, the file would be added to the jump list on Outlook. So, when a user replies to an email or starts a new email, the newly created file would be displayed when inserting a file.

What about a message box that would ask what you want to do with the new file?  Then the code could make the next move.
0
vmccuneAuthor Commented:
I have 2013.  So message Box or Command Button, If I want the code to take the freshly created PDF file and programmatically paste it to the clipboard, How would I do that?
0
Gustav BrockCIOCommented:
Anders provided the code in his second post.
1
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
Answer provided
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.