Copying & pasting programmatically

  • Thread starter Thread starter Jon Patenaude
  • Start date Start date
J

Jon Patenaude

I have an Access application that retrieves certain data
based on some criteria. What I would like to do is place
the data on the clipboard so the user can paste it into
another application. Can it be done using VBA in Access.

Thanks for any help.
Jon
 
You can copy into the clipboard but it is dependant on
objects. If you put a value into a textbox (Text1) you can
put that value into memory with this code:

Text1.SetFocus
DoCmd.RunCommand acCmdCopy

In the past I have used this code by Terry Kreft that
allows you to put variables into memory but it is a much
more complexe API call:
http://www.mvps.org/access/api/api0049.htm

-Cameron Sutherland
 
Jon Patenaude said:
I have an Access application that retrieves certain data
based on some criteria. What I would like to do is place
the data on the clipboard so the user can paste it into
another application. Can it be done using VBA in Access.

The real simple approach is using the macro

DoCmd.RunCommand acCmdCopy (copies the currently selected text)
DoCmd.RunCommand acCmdPaste

Googling on those terms will find you some sample code although
possibly not exactly what you want.

The best approach is to use an API call as per the following KB
article.
ACC: How to Send Information to the Clipboard (95/97) - 138909
http://support.microsoft.com/?kbid=138909

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
 

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

Back
Top