Let me see the code you're using.
Printable View
Let me see the code you're using.
Private Sub mnuSend_Click()
Dim thunderrtmdiform As Long
Dim mdiclient As Long
Dim thunderrtformdc As Long
Dim thunderrttextbox As Long
Do
thunderrtmdiform = FindWindow("thunderrt6mdiform", vbNullString)
mdiclient = FindWindowEx(thunderrtmdiform, 0&, "mdiclient", vbNullString)
thunderrtformdc = FindWindowEx(mdiclient, 0&, "thunderrt6formdc", vbNullString)
thunderrttextbox = FindWindowEx(thunderrtformdc, 0&, "thunderrt6textbox", vbNullString)
Call SendMessageByString(thunderrttextbox, WM_SETTEXT, 0&, Text.Text
thunderrtmdiform = FindWindow("thunderrt6mdiform", vbNullString)
mdiclient = FindWindowEx(thunderrtmdiform, 0&, "mdiclient", vbNullString)
thunderrtformdc = FindWindowEx(mdiclient, 0&, "thunderrt6formdc", vbNullString)
thunderrttextbox = FindWindowEx(thunderrtformdc, 0&, "thunderrt6textbox", vbNullString)
Call SendMessageLong(thunderrttextbox, WM_CHAR, 13, 0&)
Loop Until 'what would go here
If thunderrttextbox = 0 Then
MsgBox "You Must Have Window Open First"
Exit Sub
End If
End Sub
Well, using your above example of a 100 time limit:
Private Sub mnuSend_Click()
Dim thunderrtmdiform As Long
Dim mdiclient As Long
Dim thunderrtformdc As Long
Dim thunderrttextbox As Long
Dim I As integer
For I = 1 to 100
thunderrtmdiform = FindWindow("thunderrt6mdiform", vbNullString)
mdiclient = FindWindowEx(thunderrtmdiform, 0&, "mdiclient", vbNullString)
thunderrtformdc = FindWindowEx(mdiclient, 0&, "thunderrt6formdc", vbNullString)
thunderrttextbox = FindWindowEx(thunderrtformdc, 0&, "thunderrt6textbox", vbNullString)
Call SendMessageByString(thunderrttextbox, WM_SETTEXT, 0&, Text.Text
thunderrtmdiform = FindWindow("thunderrt6mdiform", vbNullString)
mdiclient = FindWindowEx(thunderrtmdiform, 0&, "mdiclient", vbNullString)
thunderrtformdc = FindWindowEx(mdiclient, 0&, "thunderrt6formdc", vbNullString)
thunderrttextbox = FindWindowEx(thunderrtformdc, 0&, "thunderrt6textbox", vbNullString)
Call SendMessageLong(thunderrttextbox, WM_CHAR, 13, 0&)
Next I
If thunderrttextbox = 0 Then
MsgBox "You Must Have Window Open First"
Exit Sub
End If
End Sub
That worked great, I just replaced the For I = 1 To 100 with
For I = 1 To Text1.Text
One other question, how would I keep the user from inputting anything other than numbers. I know it would be a message box but how would I go about it. And thank you for your help.
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Val(Chr(KeyAscii)) = 0 And KeyAscii <> Asc("0") Then KeyAscii = 0
End Sub
So I was wrong :) but you solved my entire problem and I thank you very much it's good to see someone willing to help someone new to vb.
Heck, that's what this site is for! :D