[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

ListView items copy to clipboard

Posted on 2004-10-23
2
Medium Priority
?
2,607 Views
Last Modified: 2011-04-14
Greetings,

I have a ListView control (in Report view, with a entire line section) with 10 or more lines and 6 columns. Now I wish to add a Copy function that will copy the selected lines (and all of the sub items) to clipboard in this format: assuming lines 1, 2 and 3 are selected.

Line1
A B C D E

Line 2
A B C D E

Line 3
F G H I J

How can I accomplish this?

Thanks1
0
Comment
Question by:sramesh2k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 19

Accepted Solution

by:
Shauli earned 500 total points
ID: 12389829
Private Sub Command1_Click()
Dim tLoop As Integer, mLoop As Integer, toClip As String, tmpSel As String
Clipboard.Clear
For tLoop = 1 To ListView1.ListItems.Count
    If ListView1.ListItems(tLoop).Selected Then
        tmpSel = ListView1.ListItems(tLoop).Text
        For mLoop = 1 To ListView1.ColumnHeaders.Count - 2
                tmpSel = tmpSel & chr(32) & ListView1.ListItems(tLoop).ListSubItems(mLoop).Text
        Next mLoop
        toClip = toClip & tmpSel & vbNewLine
    End If
Next tLoop
Clipboard.SetText toClip
End Sub

S
0
 
LVL 34

Author Comment

by:sramesh2k
ID: 12391736
It works! Thanks, Shauli.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question