how do you make items from a listbox and change them so they go into notepad? i can open, notepad, and can send the keys, but i dont know how to make the items in the listbox go in. please help me
Printable View
how do you make items from a listbox and change them so they go into notepad? i can open, notepad, and can send the keys, but i dont know how to make the items in the listbox go in. please help me
Use SendKeys.
Code:Private Sub Command1_Click()
For i = 0 To List1.ListCount - 1
DoEvents
AppActivate "Untitled - Notepad"
SendKeys List1.List(i)
SendKeys "{ENTER}"
Next i
End Sub
Add a MultiSelect Listbox to a Form:Select the items, press the button then do a CTRL + V or select Paste in Notepad.Code:Option Explicit
Private Sub Form_Load()
Dim lCount As Long
For lCount = 1 To 10
List1.AddItem "Item " & lCount
Next
End Sub
Private Sub Command1_Click()
Dim lCount As Long
Dim sClip As String
For lCount = 0 To List1.ListCount - 1
If List1.Selected(lCount) Then sClip = sClip & vbCrLf & List1.List(lCount)
Next
Clipboard.Clear
Clipboard.SetText Mid(sClip, 3)
End Sub