In a current project, I’d like to be able to copy an array of cells from a listbox into the clipboard. It’s just plain text, with no formatting of any kind, but I’d like to retain the tabular structure so that it will be recognized by Excel or other applications that can paste data as a table. It appears that on a Mac I can just use tab delimiters between fields, and set the UTI to “public.text” but I don’t know what would be acceptable on a Windows or Linux platform. I’d like to keep the number of formats to a minimum. What would be the best (easiest) format to use that’s compatible with all 3 platforms?
This copy all data from the Listbox with \Tabs as Cell delimiter and \EndOfLine as Row delimiter:
my_Data = LB.Cell(-1,-1)
I do not do anything fancy to put the data into the Clipboard (but my PC Laptop is on repair, so I cannot check).
[code]Dim Clip As New Clipboard
Clip.Text = MyData
I hope this is enough and correct.
If I understand correctly, you want to copy Listbox contents and paste to Excel/LibreOffice, this works for Mac, Linux and Windows:
Dim c As New Clipboard
c.Text = Listbox1.cell(-1,-1)
Edit: what Emile said
Excellent! That’s much easier than I was expecting.