PDA

Click to See Complete Forum and Search --> : listbox to clipboard


Doug Anderson
Jan 7th, 2000, 10:24 AM
I'm using vba6 with quattro pro
and am new to visual basic. I'd like
to copy the contents of a listbox
(or combobox) to the clipboard but
just cant figure it out.
Help or suggestions would be appreciated.
Thanks,
Doug Anderson

QWERTY
Jan 7th, 2000, 12:47 PM
To add it to the clipboard you could use this code:

Option Explicit
Dim I As Integer

Private Sub Command1_Click()
For I = 1 To List1.ListCount
If I = 1 Then
'//you can command this out
'//without this line VB adds an extra empty line to the Clipboard
Clipboard.SetText List1.List(I - 1)
Else
Clipboard.SetText (Clipboard.GetText & vbCrLf & List1.List(I - 1))
End If
Next I
End Sub

HTH


------------------
Visual Basic Programmer
------------------
PolComSoft
You will hear a lot about it.