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?
 
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
 
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
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.