Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Create a button to copy to clipboard

Create a button to copy to clipboard

I need to provide a button which, when clicked, will copy a formatted set of text to the clipboard.  Does someone know some VBA code to copy a text string to the clipboard?  In code I will combine the values in a number of controls to make one text string to copy to the clipboard, but I don't know how to copy to the clipboard (without using <Ctrl><C>).

Bob S.

RE: Create a button to copy to clipboard

without using <Ctrl><C>
DoCmd.RunCommand acCmdCopy

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886

RE: Create a button to copy to clipboard

I don't think that this will work with a variable that contains the text, but I figured out a workaround by setting up a text box of 0" width (so it basically was not visible, although visible must be set to Yes for the copy to work).  I placed the text in that control, set focus to that control, and then ran the command you provided.  Here's the code I ended up with (for the button):

Me.txtCopyText = "This is a test"
DoCmd.RunCommand acCmdCopy

Bob S.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close