Way to copy some data to clipboard to paste into spreadsheet

M

markmarko

I'd like to have a way to 'copy' certain data from our Sales Order so that
users can paste it into an online spreadsheet.

For example, users enters sales data into frmSalesOrders, then click a
button that copies AccountNumber, CustomerName, CustomerAddress into the
clipboard so user may easily paste it into an online spreadsheet.

I've tried creating a query with relevant data, which can be Copy'd to the
clipboard, but when you paste, it includes the column headers.

I'm open to any method that works, the cleanest being using code with a
recordset somehow, but I've not seen a way to programtically copy fields to
the clipboard.
 
J

Jose

Hello Allen,

I tried your function and I could use it to copy to clipboard.
I could not use the second function, copy from clipboard to a text box or to
a word document.

Could you help me?

Thanks a lot

JCO
 
J

Jose

Again Allen,

I tested your function copy to clipboard in access 2007 using a text box
rich text formatted and it doesn't work properly.
It doesn't copy the rich text, it copies the code.

If i do manually, the copy is correct.
Is correct this behavior?

Thanks,
JCP
 
A

Allen Browne

You're right Jose.

The function handles unformatted text only.

You can lose the formatting if you use:
Text2Clipboard(PlainText(Forms!frmMytable.MyRichMemo))

I'm guessing that's not what you really want, but it is what you get if you
use the built-in copy:

Private Sub cmdCopy_Click()
With Me.MyRichMemo
If IsNull(.Value) Then
Beep
Else
.SetFocus
RunCommand acCmdCopy
End If
End With
End Sub
 
J

Jose

Thanks Allen.
It works.

What I want is:
If we use recordset to copy rich text to word or excel, doesn't work, it
shows HTTML code.
So, I think the solution is, copý to clibboard from the text box and then
paste to word programatically.
Do you have another idea?
Thanks
Jose
 
A

Allen Browne

That's fine.

If you are just copying from one text box, you can just use:
Me.[YourTextboxNameHere].SetFocus
RunCommand acCmdCopy
 

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

Top