Results 1 to 3 of 3

Thread: Meant to write to text but doesn't!

  1. #1

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188

    Unhappy

    What wrong with this it's supposed to write to text file but it doesn't? Why?

    Private Sub Command5_Click()
    selct
    copy
    pste
    Dim objSearch As Collection
    Dim varSearch As Variant
    Dim intPos As Integer

    Set objSearch = New Collection
    objSearch.Add "mining"
    objSearch.Add "aurora"
    objSearch.Add "ccc"

    intPos = 0
    For Each varSearch In objSearch

    intPos = InStr(1, Text1.Text, varSearch)
    If intPos > 0 Then
    MsgBox varSearch & " was found in (" & _
    Text1.Text & ") at position " & intPos

    this part
    Open "C:\File.txt" For Append As #1
    Print varSearch & " was found in (" & _
    Text1.Text & ") at position " & intPos
    Close #1

    nextsite

    MsgBox "no results"
    nextsite
    End If
    Next
    End Sub

  2. #2
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    Code:
    Open "C:\File.txt" For Append As #1 
    Print #1, varSearch & " was found in (" & _ 
    Text1.Text & ") at position " & intPos 
    Close #1
    you didn't specify the file number...if you set the AutoRedraw property of your for to True, you'd have seen your data printed on the form...
    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

  3. #3

    Thread Starter
    PowerPoster Beacon's Avatar
    Join Date
    Jan 2001
    Location
    Pub Floor
    Posts
    3,188

    cheers

    Thanks again crptcblade.
    Another one to your tally of i o u's!
    Got a cold so i'm not thinking right today! But do i ever!

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