Smart questions
Smart answers
Smart people
Join Tek-Tips Forums

Member Login

Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

Join Tek-Tips
*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.

BSman (Programmer) (OP)
18 Oct 05 14:49
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.
18 Oct 05 14:58
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

Helpful Member!  BSman (Programmer) (OP)
18 Oct 05 15:15
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.

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!

Back To Forum

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