Results 1 to 3 of 3

Thread: from listbox to notepad.....

  1. #1

    Thread Starter
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    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
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  2. #2
    Guest
    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

  3. #3
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177
    Add a MultiSelect Listbox to a Form:
    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
    Select the items, press the button then do a CTRL + V or select Paste in Notepad.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width