Is there a way to program a button to put info into clipboard?

  • Thread starter Thread starter Guest
  • Start date Start date
That is alot of code. What I want to do is put info like Clients Name,
Address, City, State, Zip Code into the clipboard by clicking on a command
button, then load another program and paste that info using control V. --
Rickster172
 
So what if it's a lot of code? All you need to do is copy and paste that
code into your application once, and then call it the way you would any
built-in function.
 
I've just read this stuff on copying into the clipboard. I've not started
programing yet but would like to try installing this. can you tell me where I
copy it to and how I set up a button or whatever to make it work?
 
Create a new Module (make sure it's not a Class Module), copy everything
that's between Code Start and Code End, paste it into the module, and save
it. (make sure the name of the module isn't the same as any of the routines
within it.

In the Click event of your button, assuming the data you want to put in the
clipboard is in a variable strMyText, put the following code:

Call ClipBoard_SetText(strMyText)

You might also check http://support.microsoft.com/?id=138909 and
http://support.microsoft.com/?id=138910
 
Douglas, thanks for responding! I've looked at your reccomended support
sites but will need a little time to work through them! Meanwhile, at the
risk of sounding a bit of a dumbo, you've said..."assuming the data you want
to put in the clipboard is in a variable strMytext" Where does this
variable live and how does the text to be copied to the clipboard get into it?
 
The variable lives in your code.

You can assign it its value any way you want: you can base it on the content
of one or more text boxes, you can concatenate values by looping through a
recordset, you can use an Input box to get text from the user, or some other
possibility I haven't thought of at the moment.
 
Back
Top