sarcus25
Programmer
- Apr 14, 2005
- 27
Hi I am trying to find and select text and copy it from a text box. I can do that no problem but I can't seem to do a find next, the same line of text always gets selected even though it is not the only matching string. Thanks in advance.
Dim StartText, EndText, StartTag, EndTag
StartTag = "modMovieID="
EndTag = "ModID="
'Do Until Y1 = 5
X1 = 1
Y1 = Y1 + 1
If Y1 > 1 Then
X1 = StartText + 2500
End If
'Getting the start and end position of the text to be selected
'==============================================================
StartText = InStr(X1, txtSource.Text, StartTag)
'10
'EndText = InStr(txtSource.Text, EndTag)
'10
'Selects the text specifed above acording to position values above
'==================================================================
If StartText Then
txtSource.SelStart = StartText - 1
txtSource.SelLength = 44
Else
MsgBox "String Not Found"
End If
txtSource.SetFocus
'Copying selected text tothe clipboard
==========================================
'Clear the contents of the Clipboard.
Clipboard.Clear
' Copy selected text to Clipboard.
Clipboard.SetText Screen.ActiveControl.SelText
'Loop
Dim StartText, EndText, StartTag, EndTag
StartTag = "modMovieID="
EndTag = "ModID="
'Do Until Y1 = 5
X1 = 1
Y1 = Y1 + 1
If Y1 > 1 Then
X1 = StartText + 2500
End If
'Getting the start and end position of the text to be selected
'==============================================================
StartText = InStr(X1, txtSource.Text, StartTag)
'10
'EndText = InStr(txtSource.Text, EndTag)
'10
'Selects the text specifed above acording to position values above
'==================================================================
If StartText Then
txtSource.SelStart = StartText - 1
txtSource.SelLength = 44
Else
MsgBox "String Not Found"
End If
txtSource.SetFocus
'Copying selected text tothe clipboard
==========================================
'Clear the contents of the Clipboard.
Clipboard.Clear
' Copy selected text to Clipboard.
Clipboard.SetText Screen.ActiveControl.SelText
'Loop