Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a button to copy to clipboard 2

Status
Not open for further replies.

BSman

Programmer
Apr 16, 2002
718
US
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.
 
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
 
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"
Me.txtCopyText.SetFocus
DoCmd.RunCommand acCmdCopy

Thanks,
Bob S.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top