-
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
-
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...
-
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!