[RESOLVED] Irritating Problem
Hello, I am stuck. I noticed in one of my older programs I have a problem and I wanted to fix it.
It is a web browser. I added a google search button to it. When the button is pressed I wanted to save the text to file for a history in the google search combobox. That works, however it adds it 5 times each time it is searched! I have no idea why, so today I have tried to make it exit the saving sub if the text is already in there. I keep getting errors or it just keeps doing it. If someone could please help me it would be wonderful, I added the code for the whole command click below.
VB Code:
Private Sub cmdGoogle_Click()
For i = 0 To lstBlocked.ListCount + 1
If UCase(cboSearch.Text) = UCase(lstBlocked.List(i)) Then
wb1.Stop
MsgBox "The Search Contains A Word That Is In The Block List."
wb1.Stop
Exit Sub
Else: wb1.Navigate ("http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=" & cboSearch)
' Save - - Everything Above This Works Great
Dim X As Integer
Dim var1 As String
var1 = cboSearch.Text
For B = 0 To cboSearch.ListCount + 1
If UCase(cboSearch.Text) = UCase(cobsearch.Text(B)) Then
Exit Sub
Else
If var1 = "" Then Exit Sub Else
cboSearch.AddItem var1
Open App.Path & "\GoogleHistory.dat" For Output As #1
For X = 0 To cboSearch.ListCount + 1
Print #1, cboSearch.List(X)
Next X
Close #1
End If
Next i
End Sub